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/phpunit-tests.yml

    r56498 r56660  
    137137    if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }}
    138138    with:
    139       calling_status: ${{ needs.test-with-mysql.result == 'success' && needs.test-with-mariadb.result == 'success' && 'success' || ( needs.test-with-mysql.result == 'cancelled' || needs.test-with-mariadb.result == 'cancelled' ) && 'cancelled' || 'failure' }}
     139      calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }}
    140140    secrets:
    141141      SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }}
     
    156156      github.run_attempt < 2 &&
    157157      (
    158         needs.test-with-mysql.result == 'cancelled' || needs.test-with-mysql.result == 'failure' ||
    159         needs.test-with-mariadb.result == 'cancelled' || needs.test-with-mariadb.result == 'failure'
     158        contains( needs.*.result, 'cancelled' ) ||
     159        contains( needs.*.result, 'failure' )
    160160      )
    161161
Note: See TracChangeset for help on using the changeset viewer.