wordpress/.github/workflows/failed-workflow.yml
Jonathan Desrosiers fe58b3e518 Build/Test Tools: Update third-party GitHub Actions.
This updates the following third-party actions to their latest versions:

- `actions/cache`
- `actions/checkout`
- `actions/setup-node`
- `actions/github-script`
- `slackapi/slack-github-action`

The latest versions of these actions fix the warnings that are being triggered after the deprecation of `set-output` and `save-state` on GitHub Actions.

For more information, see https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/.

See #56820.

git-svn-id: https://develop.svn.wordpress.org/trunk@54511 602fd350-edb4-49c9-b593-d223f7449a82
2022-10-13 17:49:07 +00:00

49 lines
1.4 KiB
YAML

##
# Performs follow-up tasks when a workflow fails or is cancelled.
##
name: Failed Workflow
on:
workflow_dispatch:
inputs:
run_id:
description: 'ID of the GitHub Action workflow run to rerun'
required: true
type: 'string'
jobs:
# Attempts to rerun a workflow.
#
# Performs the following steps:
# - Retrieves the workflow run that dispatched this workflow.
# - Restarts all failed jobs when the workflow fails or is cancelled for the first time.
failed-workflow:
name: Rerun a workflow
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Rerun a workflow
uses: actions/github-script@100527700e8b29ca817ac0e0dfbfc5e8ff38edda # v6.3.2
with:
retries: 2
retry-exempt-status-codes: 418
script: |
const workflow_run = await github.rest.actions.getWorkflowRun({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ inputs.run_id }},
});
// Only rerun after the first run attempt.
if ( workflow_run.data.run_attempt > 1 ) {
return;
}
const rerun = await github.rest.actions.reRunWorkflowFailedJobs({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ inputs.run_id }},
enable_debug_logging: true
});