WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/29/2021 07:47:43 PM (3 months ago)
Author:
desrosj
Message:

Build/Test Tools: Post a message to #core in Slack when a workflow fails.

This adds an additional step to each GitHub Action workflow file that posts a message to #core in Slack every time a workflow run fails.

A minor test and spacing change is included in this commit in order to that messages are posted correctly and will be reverted after testing.

See #52644.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/javascript-tests.yml

    r51355 r51511  
    5151  # - Run the WordPress QUnit tests.
    5252  # - Ensures version-controlled files are not modified or deleted.
    53   # - todo: Configure Slack notifications for failing tests.
    5453  test-js:
    5554    name: QUnit Tests
     
    8786      - name: Ensure version-controlled files are not modified or deleted
    8887        run: git diff --exit-code
     88
     89  # Post workflow related status updates to Slack.
     90  #
     91  # When a job in this workflow fails, a message is posted to #core.
     92  #
     93  # This job should always require all other jobs in this workflow to complete before running.
     94  slack-notifications:
     95    name: Slack Notifications
     96    runs-on: ubuntu-latest
     97    needs: [ test-js ]
     98    if: ${{ failure() && github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' }}
     99
     100    steps:
     101      - name: Post failure notification to Slack
     102        uses: slackapi/slack-github-action@d5d276d7ae0f38f29322b80da9baf985cc80f8b1 # v1.15.0
     103        with:
     104          payload: "{\"workflow_name\":\"${{ github.workflow }}\",\"run_url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"
     105        env:
     106          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GHA_WEBHOOK_URL }}
Note: See TracChangeset for help on using the changeset viewer.