55 branches-ignore :
66 - ' gh-readonly-queue/**' # don't run (again) when on these special branches created during merge groups; the `on: merge_group` already triggers it.
77 merge_group :
8+ pull_request :
89
910env :
1011 PYTHONUNBUFFERED : True
1920 permissions :
2021 contents : write # needed for updating dependabot branches
2122
23+ check-skip-duplicate :
24+ runs-on : ubuntu-24.04
25+ permissions :
26+ contents : read
27+ pull-requests : read # needed to check if PR exists for current branch
28+ outputs :
29+ should-run : ${{ steps.check.outputs.should-run }}
30+ steps :
31+ - name : Checkout code
32+ uses : actions/checkout@v6.0.2
33+ with :
34+ persist-credentials : false
35+ - id : check
36+ uses : ./.github/actions/check-skip-duplicates
37+
2238 pre-commit :
2339 needs :
2440 - get-values
41+ - check-skip-duplicate
42+ if : needs.check-skip-duplicate.outputs.should-run == 'true'
2543 uses : ./.github/workflows/pre-commit.yaml
2644 permissions :
2745 contents : write # needed for mutex
3250 unit-test :
3351 needs :
3452 - pre-commit
53+ - check-skip-duplicate
54+ if : needs.check-skip-duplicate.outputs.should-run == 'true'
3555 strategy :
3656 matrix :
3757 os :
6686 lint-matrix :
6787 needs :
6888 - pre-commit
89+ - check-skip-duplicate
90+ if : needs.check-skip-duplicate.outputs.should-run == 'true'
6991 strategy :
7092 matrix :
7193 os :
@@ -178,17 +200,21 @@ jobs:
178200 path : " ${{ github.workspace }}/.precommit_cache/pre-commit.log"
179201
180202 confirm-on-tagged-copier-template :
203+ needs :
204+ - check-skip-duplicate
205+ if : ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
181206 uses : ./.github/workflows/confirm-on-tagged-copier-template.yaml
182207 permissions :
183208 contents : read
184209 pull-requests : read # needed to check if PR exists for current branch
185210
186211
187- required-check :
212+ workflow-summary :
188213 runs-on : ubuntu-24.04
189214 timeout-minutes : 2
190215 needs :
191216 - get-values
217+ - check-skip-duplicate
192218 - confirm-on-tagged-copier-template
193219 - pre-commit
194220 - unit-test
@@ -203,13 +229,26 @@ jobs:
203229
204230 if [[ ! "${{ needs.get-values.result }}" =~ $success_pattern ]] ||
205231 [[ ! "${{ needs.confirm-on-tagged-copier-template.result }}" =~ $success_pattern ]] ||
232+ [[ ! "${{ needs.check-skip-duplicate.result }}" =~ $success_pattern ]] ||
206233 [[ ! "${{ needs.pre-commit.result }}" =~ $success_pattern ]] ||
207234 [[ ! "${{ needs.unit-test.result }}" =~ $success_pattern ]] ||
208235 [[ ! "${{ needs.lint-matrix.result }}" =~ $success_pattern ]]; then
209236 echo "❌ One or more jobs did not finish with skipped or success"
210237 exit 1
211238 fi
212239 echo "✅ All jobs finished with skipped or success"
240+
241+ - name : Mark the required-check as succeeded so the PR can be merged
242+ if : ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
243+ env :
244+ GH_TOKEN : ${{ github.token }}
245+ run : |
246+ gh api \
247+ -X POST -H "Accept: application/vnd.github.v3+json" \
248+ "${{ github.event.pull_request.statuses_url }}" \
249+ -f state=success -f context="required-check" -f description="✅ All required checks passed in the job triggered by pull_request" \
250+ -f target_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
251+
213252 - name : Mark updated dependabot hash commit as succeeded
214253 if : needs.get-values.outputs.dependabot-commit-created == 'true'
215254 env :
0 commit comments