mirror of
git://develop.git.wordpress.org/
synced 2025-04-21 04:31:55 +02:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@52002 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
387269d5e5
commit
9cfdfd4ecd
2
.github/workflows/coding-standards.yml
vendored
2
.github/workflows/coding-standards.yml
vendored
@ -152,6 +152,8 @@ jobs:
|
||||
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@master
|
||||
needs: [ phpcs, jshint ]
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||
with:
|
||||
calling_status: ${{ needs.phpcs.result == 'success' && needs.jshint.result == 'success' && 'success' || ( needs.phpcs.result == 'cancelled' || needs.jshint.result == 'cancelled' ) && 'cancelled' || 'failure' }}
|
||||
secrets:
|
||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||
|
2
.github/workflows/end-to-end-tests.yml
vendored
2
.github/workflows/end-to-end-tests.yml
vendored
@ -122,6 +122,8 @@ jobs:
|
||||
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@master
|
||||
needs: [ e2e-tests ]
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||
with:
|
||||
calling_status: ${{ needs.e2e-tests.result == 'success' && 'success' || needs.e2e-tests.result == 'cancelled' && 'cancelled' || 'failure' }}
|
||||
secrets:
|
||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||
|
2
.github/workflows/javascript-tests.yml
vendored
2
.github/workflows/javascript-tests.yml
vendored
@ -91,6 +91,8 @@ jobs:
|
||||
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@master
|
||||
needs: [ test-js ]
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||
with:
|
||||
calling_status: ${{ needs.test-js.result == 'success' && 'success' || needs.test-js.result == 'cancelled' && 'cancelled' || 'failure' }}
|
||||
secrets:
|
||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||
|
2
.github/workflows/php-compatibility.yml
vendored
2
.github/workflows/php-compatibility.yml
vendored
@ -93,6 +93,8 @@ jobs:
|
||||
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@master
|
||||
needs: [ php-compatibility ]
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||
with:
|
||||
calling_status: ${{ needs.php-compatibility.result == 'success' && 'success' || needs.php-compatibility.result == 'cancelled' && 'cancelled' || 'failure' }}
|
||||
secrets:
|
||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||
|
2
.github/workflows/phpunit-tests.yml
vendored
2
.github/workflows/phpunit-tests.yml
vendored
@ -248,6 +248,8 @@ jobs:
|
||||
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@master
|
||||
needs: [ test-php ]
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||
with:
|
||||
calling_status: ${{ needs.test-php.result == 'success' && 'success' || needs.test-php.result == 'cancelled' && 'cancelled' || 'failure' }}
|
||||
secrets:
|
||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||
|
13
.github/workflows/slack-notifications.yml
vendored
13
.github/workflows/slack-notifications.yml
vendored
@ -23,6 +23,11 @@ on:
|
||||
- '5.[0-8]'
|
||||
|
||||
workflow_call:
|
||||
inputs:
|
||||
calling_status:
|
||||
description: 'The status of the calling workflow'
|
||||
type: string
|
||||
required: true
|
||||
secrets:
|
||||
SLACK_GHA_SUCCESS_WEBHOOK:
|
||||
description: 'The Slack webhook URL for a successful build.'
|
||||
@ -125,7 +130,7 @@ jobs:
|
||||
name: Failure notifications
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ prepare ]
|
||||
if: ${{ github.event_name == 'push' && failure() || github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'failure' }}
|
||||
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'failure' || inputs.calling_status == 'failure' || failure() }}
|
||||
|
||||
steps:
|
||||
- name: Post failure notifications to Slack
|
||||
@ -140,7 +145,7 @@ jobs:
|
||||
name: Fixed notifications
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ prepare ]
|
||||
if: ${{ needs.prepare.outputs.previous_conclusion == 'failure' && ( github.event_name == 'push' && success() || github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' ) }}
|
||||
if: ${{ needs.prepare.outputs.previous_conclusion == 'failure' && ( github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' || inputs.calling_status == 'success' ) && success() }}
|
||||
|
||||
steps:
|
||||
- name: Post failure notifications to Slack
|
||||
@ -155,7 +160,7 @@ jobs:
|
||||
name: Success notifications
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ prepare ]
|
||||
if: ${{ github.event_name == 'push' && success() || github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' }}
|
||||
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' || inputs.calling_status == 'success' && success() }}
|
||||
|
||||
steps:
|
||||
- name: Post success notifications to Slack
|
||||
@ -170,7 +175,7 @@ jobs:
|
||||
name: Cancelled notifications
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ prepare ]
|
||||
if: ${{ github.event_name == 'push' && cancelled() || github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'cancelled' }}
|
||||
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'cancelled' || inputs.calling_status == 'cancelled' || cancelled() }}
|
||||
|
||||
steps:
|
||||
- name: Post cancelled notifications to Slack
|
||||
|
2
.github/workflows/test-coverage.yml
vendored
2
.github/workflows/test-coverage.yml
vendored
@ -174,6 +174,8 @@ jobs:
|
||||
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@master
|
||||
needs: [ test-coverage-report ]
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||
with:
|
||||
calling_status: ${{ needs.test-coverage-report.result == 'success' && 'success' || needs.test-coverage-report.result == 'cancelled' && 'cancelled' || 'failure' }}
|
||||
secrets:
|
||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||
|
2
.github/workflows/test-npm.yml
vendored
2
.github/workflows/test-npm.yml
vendored
@ -160,6 +160,8 @@ jobs:
|
||||
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@master
|
||||
needs: [ test-npm, test-npm-macos ]
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||
with:
|
||||
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' }}
|
||||
secrets:
|
||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||
|
2
.github/workflows/test-old-branches.yml
vendored
2
.github/workflows/test-old-branches.yml
vendored
@ -75,6 +75,8 @@ jobs:
|
||||
uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@master
|
||||
needs: [ dispatch-workflows-for-old-branches ]
|
||||
if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
|
||||
with:
|
||||
calling_status: ${{ needs.dispatch-workflows-for-old-branches.result == 'success' && 'success' || needs.dispatch-workflows-for-old-branches.result == 'cancelled' && 'cancelled' || 'failure' }}
|
||||
secrets:
|
||||
SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
|
||||
SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user