File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : PR Approval Check
22
33on :
4- pull_request_review :
5- types : [submitted, dismissed]
64 pull_request :
75 branches :
86 - " develop"
Original file line number Diff line number Diff line change 1+ # Re-runs the PR Approval Check workflow when a review is submitted or dismissed.
2+ # Re-running creates a new attempt on the existing approvals.yml workflow run, which
3+ # updates the `check-approvals` check_run in place. This avoids the gate getting stuck
4+ # behind a stale failed check_run from the original `pull_request` event run.
5+
6+ name : Re-run PR Approval Check on Review
7+
8+ on :
9+ pull_request_review :
10+ types : [submitted, dismissed]
11+
12+ permissions :
13+ actions : write
14+
15+ concurrency :
16+ group : rerun-approvals-${{ github.event.pull_request.head.sha }}
17+ cancel-in-progress : true
18+
19+ jobs :
20+ rerun :
21+ if : github.event.pull_request.base.ref == 'develop'
22+ runs-on : ubuntu-latest
23+ timeout-minutes : 5
24+ steps :
25+ - name : Re-run approvals workflow for this PR's head SHA
26+ env :
27+ GH_TOKEN : ${{ github.token }}
28+ REPO : ${{ github.repository }}
29+ HEAD_SHA : ${{ github.event.pull_request.head.sha }}
30+ run : |
31+ set -euo pipefail
32+ run_id=$(gh api \
33+ "repos/$REPO/actions/workflows/approvals.yml/runs?head_sha=$HEAD_SHA" \
34+ --jq '.workflow_runs[0].id // empty')
35+ if [ -z "$run_id" ]; then
36+ echo "No approvals.yml run for $HEAD_SHA — nothing to re-run."
37+ exit 0
38+ fi
39+ echo "Re-running approvals.yml run $run_id"
40+ gh api -X POST "repos/$REPO/actions/runs/$run_id/rerun"
You can’t perform that action at this time.
0 commit comments