Make WordPress Core


Ignore:
Timestamp:
09/22/2023 02:28:01 PM (7 months ago)
Author:
desrosj
Message:

Build/Test Tools: Simplify some logic in GitHub Action workflows.

This simplifies the logic within the slack-notifications and failed-workflow steps in GitHub Action workflows to use the contains() function and object filtering.

This makes it simpler to perform the needed checks by removing the need to list out every single dependent job defined in needs.

See #58867.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/test-npm.yml

    r56659 r56660  
    185185    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    186186    with:
    187       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' }}
     187      calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
    188188    secrets:
    189189      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
     
    204204      github.run_attempt < 2 &&
    205205      (
    206         needs.test-npm.result == 'cancelled' || needs.test-npm.result == 'failure' ||
    207         needs.test-npm-macos.result == 'cancelled' || needs.test-npm-macos.result == 'failure'
     206        contains( needs.*.result, 'cancelled' ) ||
     207        contains( needs.*.result, 'failure' )
    208208      )
    209209
Note: See TracChangeset for help on using the changeset viewer.