Make WordPress Core


Ignore:
Timestamp:
07/29/2021 07:47:43 PM (4 years 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/phpunit-tests.yml

    r51355 r51511  
    6060  # - Reconnect the directory to the Git repository.
    6161  # - Submit the test results to the WordPress.org host test results.
    62   # - todo: Configure Slack notifications for failing tests.
    6362  test-php:
    6463    name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
     
    238237          WPT_REPORT_API_KEY: "${{ secrets.WPT_REPORT_API_KEY }}"
    239238        run: docker-compose run --rm -e WPT_REPORT_API_KEY -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php
     239
     240  # Post workflow related status updates to Slack.
     241  #
     242  # When a job in this workflow fails, a message is posted to #core.
     243  #
     244  # This job should always require all other jobs in this workflow to complete before running.
     245  slack-notifications:
     246    name: Slack Notifications
     247    runs-on: ubuntu-latest
     248    needs: [ test-php ]
     249    if: ${{ failure() && github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' }}
     250
     251    steps:
     252      - name: Post failure notification to Slack
     253        uses: slackapi/slack-github-action@d5d276d7ae0f38f29322b80da9baf985cc80f8b1 # v1.15.0
     254        with:
     255          payload: "{\"workflow_name\":\"${{ github.workflow }}\",\"run_url\":\"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"
     256        env:
     257          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GHA_WEBHOOK_URL }}
Note: See TracChangeset for help on using the changeset viewer.