diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 2840a77..04d87fc 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -8,7 +8,7 @@ on: jobs: deploy: runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} + if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event != 'schedule' }} steps: - uses: actions/checkout@v3 - name: Tag and Push Gem diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c47974..7e22909 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,12 @@ name: CI -on: [push, pull_request] +on: + push: + branches: + - main + pull_request: + schedule: + - cron: "0 0 * * *" jobs: rspec: @@ -10,7 +16,7 @@ jobs: ruby: # See comment comes from https://github.com/ruby/setup-ruby#matrix-of-ruby-versions # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0' - - '3.0.6' + - "3.0.6" - 3.1 - 3.2 - 3.3 @@ -27,7 +33,7 @@ jobs: - name: Set up Ruby ${{ matrix.ruby }} uses: ruby/setup-ruby@v1 with: - bundler-cache: false + bundler-cache: false ruby-version: ${{ matrix.ruby }} - name: Update bundler run: gem install bundler && bundle install @@ -45,3 +51,17 @@ jobs: ruby-version: head - name: Run static type checks run: bundle exec srb tc + notify_on_failure: + runs-on: ubuntu-latest + needs: [rspec, static_type_check] + if: ${{ failure() && github.ref == 'refs/heads/main' }} + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK + steps: + - uses: slackapi/slack-github-action@v1.25.0 + with: + payload: | + { + "text": "${{ github.repository }}/${{ github.ref }}: FAILED\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + }