mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 21:08:44 +01:00
8d56facbeb
This updates all 3rd-party GitHub Actions to their latest versions. See #58867. git-svn-id: https://develop.svn.wordpress.org/trunk@56388 602fd350-edb4-49c9-b593-d223f7449a82
55 lines
1.6 KiB
YAML
55 lines
1.6 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'
|
|
|
|
# Disable permissions for all available scopes by default.
|
|
# Any needed permissions should be configured at the job level.
|
|
permissions: {}
|
|
|
|
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
|
|
permissions:
|
|
actions: write
|
|
timeout-minutes: 5
|
|
|
|
steps:
|
|
- name: Rerun a workflow
|
|
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
|
|
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
|
|
});
|