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/coding-standards.yml

    r56659 r56660  
    183183    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    184184    with:
    185       calling_status: ${{ needs.phpcs.result == 'success' && needs.jshint.result == 'success' && 'success' || ( needs.phpcs.result == 'cancelled' || needs.jshint.result == 'cancelled' ) && 'cancelled' || 'failure' }}
     185      calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
    186186    secrets:
    187187      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
     
    202202      github.run_attempt < 2 &&
    203203      (
    204         needs.phpcs.result == 'cancelled' || needs.phpcs.result == 'failure' ||
    205         needs.jshint.result == 'cancelled' || needs.jshint.result == 'failure'
     204        contains( needs.*.result, 'cancelled' ) ||
     205        contains( needs.*.result, 'failure' )
    206206      )
    207207
Note: See TracChangeset for help on using the changeset viewer.