Make WordPress Core


Ignore:
Timestamp:
08/26/2022 07:19:11 PM (3 years ago)
Author:
desrosj
Message:

Build/Test Tools: Automatically rerun a workflow the first time it fails.

There are several common reoccurring issues that sometimes cause GitHub Action workflows to fail (connection timeouts to WordPress.org or the Docker container registry, npm install failures, Chromium issues, etc.). Except when there are service level outages, most of these issues can be resolved by simply rerunning the workflow.

This introduces a new step within each of Core’s GitHub Action workflows that attempts to rerun the failed jobs within the workflow that encountered a failure if they are running for the first time. Since a workflow is not allowed to restart itself, a new failed-workflow.yml callable workflow is being introduced.

Other related adjustments in this changeset:

  • The actions/github-script 3rd-party action is also now updated to the latest version (v6.2.0).
  • A new secret, GHA_WORKFLOW_DISPATCH, has been introduced. This will replace the current one in use (GHA_OLD_BRANCH_DISPATCH) with a less specific name.

Props jorbin, desrosj.
Fixes #56407.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/php-compatibility.yml

    r53940 r53947  
    115115      SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }}
    116116      SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }}
     117
     118  failed-workflow:
     119    name: Failed workflow tasks
     120    runs-on: ubuntu-latest
     121    needs: [ php-compatibility, slack-notifications ]
     122    if: |
     123      always() &&
     124      github.repository == 'WordPress/wordpress-develop' &&
     125      github.event_name != 'pull_request' &&
     126      github.run_number < 2 &&
     127      (
     128        needs.php-compatibility.result == 'cancelled' || needs.php-compatibility.result == 'failure'
     129      )
     130
     131    steps:
     132      - name: Dispatch workflow run
     133        uses: actions/github-script@c713e510dbd7d213d92d41b7a7805a986f4c5c66 # v6.2.0
     134        with:
     135          github-token: ${{ secrets.GHA_WORKFLOW_DISPATCH }}
     136          script: |
     137            github.rest.actions.createWorkflowDispatch({
     138              owner: context.repo.owner,
     139              repo: context.repo.repo,
     140              workflow_id: 'failed-workflow.yml',
     141              ref: '${{ github.ref_name }}',
     142              inputs: {
     143                run_id: '${{ github.run_id }}'
     144              }
     145            });
Note: See TracChangeset for help on using the changeset viewer.