File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Rerun PR Checks
2+ description : Reruns failed or cancelled jobs of the latest completed run of a workflow for the current PR SHA
3+
4+ inputs :
5+ workflow-id :
6+ description : Workflow filename to rerun
7+ required : false
8+ default : pull-request.yml
9+ github-token :
10+ description : GitHub token with actions:write permission
11+ required : false
12+ default : ${{ github.token }}
13+
14+ runs :
15+ using : composite
16+ steps :
17+ - name : Rerun failed jobs
18+ uses : actions/github-script@v7
19+ with :
20+ github-token : ${{ inputs.github-token }}
21+ script : |
22+ const owner = context.repo.owner;
23+ const repo = context.repo.repo;
24+ const headSha = context.payload.pull_request.head.sha;
25+
26+ const runs = await github.rest.actions.listWorkflowRunsForRepo({
27+ owner,
28+ repo,
29+ workflow_id: '${{ inputs.workflow-id }}',
30+ event: 'pull_request',
31+ head_sha: headSha,
32+ status: 'completed',
33+ });
34+
35+ const run = runs.data.workflow_runs[0];
36+ if (run) {
37+ await github.rest.actions.reRunWorkflowFailedJobs({
38+ owner,
39+ repo,
40+ run_id: run.id,
41+ });
42+ }
You can’t perform that action at this time.
0 commit comments