File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -143,3 +143,38 @@ jobs:
143143 npm run lint
144144 npm run lint:markdown
145145 npm run lint:readme
146+
147+ all-pr-checks-pass :
148+ runs-on : ubuntu-latest
149+ needs : [static-code-checks, contract-test, lint, build]
150+ if : always()
151+ steps :
152+ - name : Checkout to get workflow file
153+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
154+
155+ - name : Check all jobs succeeded and none missing
156+ run : |
157+ # Check if all needed jobs succeeded
158+ results='${{ toJSON(needs) }}'
159+ if echo "$results" | jq -r '.[] | .result' | grep -v success; then
160+ echo "Some jobs failed"
161+ exit 1
162+ fi
163+
164+ # Extract all job names from workflow (excluding this gate job)
165+ all_jobs=$(yq eval '.jobs | keys | .[]' .github/workflows/pr-build.yml | grep -v "all-pr-checks-pass" | sort)
166+
167+ # Extract job names from needs array
168+ needed_jobs='${{ toJSON(needs) }}'
169+ needs_list=$(echo "$needed_jobs" | jq -r 'keys[]' | sort)
170+
171+ # Check if any jobs are missing from needs
172+ missing_jobs=$(comm -23 <(echo "$all_jobs") <(echo "$needs_list"))
173+ if [ -n "$missing_jobs" ]; then
174+ echo "ERROR: Jobs missing from needs array in all-pr-checks-pass:"
175+ echo "$missing_jobs"
176+ echo "Please add these jobs to the needs array of all-pr-checks-pass"
177+ exit 1
178+ fi
179+
180+ echo "All checks passed and no jobs missing from gate!"
You can’t perform that action at this time.
0 commit comments