Make WordPress Core

Changeset 52002


Ignore:
Timestamp:
11/03/2021 02:54:20 PM (3 years ago)
Author:
desrosj
Message:

Build/Test Tools: Pass workflow outcome to Slack Notifications.

When using a workflow as a callable workflow, the job status check functions do not take the called workflow into account. This has caused some failures to be incorrectly reported as successful.

This adds an input to the Slack notifications workflow for when the workflow_call event is used.

See #53363.

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

Legend:

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

    r51937 r52002  
    153153    needs: [ phpcs, jshint ]
    154154    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     155    with:
     156      calling_status: ${{ needs.phpcs.result == 'success' && needs.jshint.result == 'success' && 'success' || ( needs.phpcs.result == 'cancelled' || needs.jshint.result == 'cancelled' ) && 'cancelled' || 'failure' }}
    155157    secrets:
    156158      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
  • trunk/.github/workflows/end-to-end-tests.yml

    r51937 r52002  
    123123    needs: [ e2e-tests ]
    124124    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     125    with:
     126      calling_status: ${{ needs.e2e-tests.result == 'success' && 'success' || needs.e2e-tests.result == 'cancelled' && 'cancelled' || 'failure' }}
    125127    secrets:
    126128      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
  • trunk/.github/workflows/javascript-tests.yml

    r51937 r52002  
    9292    needs: [ test-js ]
    9393    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     94    with:
     95      calling_status: ${{ needs.test-js.result == 'success' && 'success' || needs.test-js.result == 'cancelled' && 'cancelled' || 'failure' }}
    9496    secrets:
    9597      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
  • trunk/.github/workflows/php-compatibility.yml

    r51937 r52002  
    9494    needs: [ php-compatibility ]
    9595    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     96    with:
     97      calling_status: ${{ needs.php-compatibility.result == 'success' && 'success' || needs.php-compatibility.result == 'cancelled' && 'cancelled' || 'failure' }}
    9698    secrets:
    9799      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
  • trunk/.github/workflows/phpunit-tests.yml

    r51937 r52002  
    249249    needs: [ test-php ]
    250250    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     251    with:
     252      calling_status: ${{ needs.test-php.result == 'success' && 'success' || needs.test-php.result == 'cancelled' && 'cancelled' || 'failure' }}
    251253    secrets:
    252254      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
  • trunk/.github/workflows/slack-notifications.yml

    r51954 r52002  
    2424
    2525  workflow_call:
     26    inputs:
     27      calling_status:
     28        description: 'The status of the calling workflow'
     29        type: string
     30        required: true
    2631    secrets:
    2732      SLACK_GHA_SUCCESS_WEBHOOK:
     
    126131    runs-on: ubuntu-latest
    127132    needs: [ prepare ]
    128     if: ${{ github.event_name == 'push' && failure() || github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'failure' }}
     133    if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'failure' || inputs.calling_status == 'failure' || failure() }}
    129134
    130135    steps:
     
    141146    runs-on: ubuntu-latest
    142147    needs: [ prepare ]
    143     if: ${{ needs.prepare.outputs.previous_conclusion == 'failure' && ( github.event_name == 'push' && success() || github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' ) }}
     148    if: ${{ needs.prepare.outputs.previous_conclusion == 'failure' && ( github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' || inputs.calling_status == 'success' ) && success() }}
    144149
    145150    steps:
     
    156161    runs-on: ubuntu-latest
    157162    needs: [ prepare ]
    158     if: ${{ github.event_name == 'push' && success() || github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' }}
     163    if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' || inputs.calling_status == 'success' && success() }}
    159164
    160165    steps:
     
    171176    runs-on: ubuntu-latest
    172177    needs: [ prepare ]
    173     if: ${{ github.event_name == 'push' && cancelled() || github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'cancelled' }}
     178    if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'cancelled' || inputs.calling_status == 'cancelled' || cancelled() }}
    174179
    175180    steps:
  • trunk/.github/workflows/test-coverage.yml

    r51937 r52002  
    175175    needs: [ test-coverage-report ]
    176176    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     177    with:
     178      calling_status: ${{ needs.test-coverage-report.result == 'success' && 'success' || needs.test-coverage-report.result == 'cancelled' && 'cancelled' || 'failure' }}
    177179    secrets:
    178180      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
  • trunk/.github/workflows/test-npm.yml

    r51937 r52002  
    161161    needs: [ test-npm, test-npm-macos ]
    162162    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     163    with:
     164      calling_status: ${{ needs.test-npm.result == 'success' && needs.test-npm-macos.result == 'success' && 'success' || ( needs.test-npm.result == 'cancelled' || needs.test-npm-macos.result == 'cancelled' ) && 'cancelled' || 'failure' }}
    163165    secrets:
    164166      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
  • trunk/.github/workflows/test-old-branches.yml

    r51937 r52002  
    7676    needs: [ dispatch-workflows-for-old-branches ]
    7777    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
     78    with:
     79      calling_status: ${{ needs.dispatch-workflows-for-old-branches.result == 'success' && 'success' || needs.dispatch-workflows-for-old-branches.result == 'cancelled' && 'cancelled' || 'failure' }}
    7880    secrets:
    7981      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
Note: See TracChangeset for help on using the changeset viewer.