Skip to content

Commit 6f110ed

Browse files
committed
Test 2
1 parent b234569 commit 6f110ed

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

.github/workflows/pr-build.yml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,38 @@ jobs:
164164

165165
all-pr-checks-pass:
166166
runs-on: ubuntu-latest
167-
needs: [static-code-checks, lint, build, build-lambda, spotless]
167+
needs: [static-code-checks, lint, spotless, blotless]
168168
if: always()
169169
steps:
170-
- name: Check all jobs succeeded
170+
- name: Checkout to get workflow file
171+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #5.0.0
172+
173+
- name: Check all jobs succeeded and none missing
171174
run: |
175+
# Check if all needed jobs succeeded
172176
results='${{ toJSON(needs) }}'
173177
if echo "$results" | jq -r '.[] | .result' | grep -v success; then
174178
echo "Some jobs failed"
175179
exit 1
176180
fi
177-
echo "All checks passed!"
181+
182+
# Extract all job names from workflow (excluding this gate job)
183+
all_jobs=$(yq eval '.jobs | keys | .[]' .github/workflows/pr-build.yml | grep -v "all-pr-checks-pass" | sort)
184+
185+
# Extract job names from needs array
186+
needed_jobs='${{ toJSON(needs) }}'
187+
needs_list=$(echo "$needed_jobs" | jq -r 'keys[]' | sort)
188+
189+
echo "All jobs in workflow: $all_jobs"
190+
echo "Jobs in needs array: $needs_list"
191+
192+
# Check if any jobs are missing from needs
193+
missing_jobs=$(comm -23 <(echo "$all_jobs") <(echo "$needs_list"))
194+
if [ -n "$missing_jobs" ]; then
195+
echo "ERROR: Jobs missing from needs array in all-pr-checks-pass:"
196+
echo "$missing_jobs"
197+
echo "Please add these jobs to the needs array of all-pr-checks-pass"
198+
exit 1
199+
fi
200+
201+
echo "All checks passed and no jobs missing from gate!"

0 commit comments

Comments
 (0)