Make WordPress Core


Ignore:
Timestamp:
09/22/2023 02:28:01 PM (15 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-and-zip-default-themes.yml

    r56537 r56660  
    156156    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    157157    with:
    158       calling_status: ${{ needs.test-build-scripts.result == 'success' && needs.bundle-theme.result == 'success' && 'success' || ( needs.test-build-scripts.result == 'cancelled' || needs.bundle-theme.result == 'cancelled' ) && 'cancelled' || 'failure' }}
     158      calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
    159159    secrets:
    160160      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
     
    175175      github.run_attempt < 2 &&
    176176      (
    177         needs.test-build-scripts.result == 'cancelled' || needs.test-build-scripts.result == 'failure' ||
    178         needs.bundle-theme.result == 'cancelled' || needs.bundle-theme.result == 'failure'
     177        contains( needs.*.result, 'cancelled' ) ||
     178        contains( needs.*.result, 'failure' )
    179179      )
    180180
Note: See TracChangeset for help on using the changeset viewer.