Make WordPress Core

Changeset 51937


Ignore:
Timestamp:
10/25/2021 08:26:45 PM (3 years ago)
Author:
desrosj
Message:

Build/Test Tools: Use the correct workflow name in notifications on workflow_run.

When a workflow is triggered through a workflow_run event, the context is not the original workflow. The details about the original workflow are passed through the github.event context.

This also moves the conditional check controlling whether the Slack workflow is run into the calling workflows to prevent them from running for pull requests.

Follow up to [51921-51922,51924-51925,51934].

See #53363.

Location:
trunk/.github/workflows
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/coding-standards.yml

    r51925 r51937  
    152152    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@master
    153153    needs: [ phpcs, jshint ]
    154     if: ${{ always() }}
     154    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    155155    secrets:
    156156      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
  • trunk/.github/workflows/end-to-end-tests.yml

    r51924 r51937  
    122122    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@master
    123123    needs: [ e2e-tests ]
    124     if: ${{ always() }}
     124    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    125125    secrets:
    126126      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
  • trunk/.github/workflows/javascript-tests.yml

    r51924 r51937  
    9191    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@master
    9292    needs: [ test-js ]
    93     if: ${{ always() }}
     93    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    9494    secrets:
    9595      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
  • trunk/.github/workflows/php-compatibility.yml

    r51924 r51937  
    9393    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@master
    9494    needs: [ php-compatibility ]
    95     if: ${{ always() }}
     95    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    9696    secrets:
    9797      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
  • trunk/.github/workflows/phpunit-tests.yml

    r51924 r51937  
    248248    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@master
    249249    needs: [ test-php ]
    250     if: ${{ always() }}
     250    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    251251    secrets:
    252252      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
  • trunk/.github/workflows/slack-notifications.yml

    r51934 r51937  
    119119      - name: Construct payload and store as an output
    120120        id: create-payload
    121         run: echo "::set-output name=payload::{\"workflow_name\":\"${{ github.workflow }}\",\"ref_name\":\"${{ env.CURRENT_BRANCH }}\",\"run_url\":\"${{ github.event_name == 'workflow_run' && github.event.workflow_run.html_url || steps.current-workflow-url.outputs.result }}\",\"commit_message\":\"${{ steps.commit-message.outputs.commit_message_escaped }}\"}"
     121        run: echo "::set-output name=payload::{\"workflow_name\":\"${{ github.event_name == 'workflow_run' && github.event.workflow_run.name || github.workflow }}\",\"ref_name\":\"${{ env.CURRENT_BRANCH }}\",\"run_url\":\"${{ github.event_name == 'workflow_run' && github.event.workflow_run.html_url || steps.current-workflow-url.outputs.result }}\",\"commit_message\":\"${{ steps.commit-message.outputs.commit_message_escaped }}\"}"
    122122
    123123  # Posts notifications when a workflow fails.
  • trunk/.github/workflows/test-coverage.yml

    r51924 r51937  
    174174    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@master
    175175    needs: [ test-coverage-report ]
    176     if: ${{ always() }}
     176    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    177177    secrets:
    178178      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
  • trunk/.github/workflows/test-npm.yml

    r51924 r51937  
    160160    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@master
    161161    needs: [ test-npm, test-npm-macos ]
    162     if: ${{ always() }}
     162    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    163163    secrets:
    164164      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
  • trunk/.github/workflows/test-old-branches.yml

    r51924 r51937  
    7575    uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@master
    7676    needs: [ dispatch-workflows-for-old-branches ]
    77     if: ${{ always() }}
     77    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    7878    secrets:
    7979      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
Note: See TracChangeset for help on using the changeset viewer.