Skip to content

Commit cb93dc6

Browse files
committed
fixall
1 parent 0eebbde commit cb93dc6

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

.github/workflows/codeql.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,35 @@ jobs:
101101
needs: [analyze]
102102
if: always()
103103
steps:
104-
- name: Check all jobs succeeded
104+
- name: Checkout to get workflow file
105+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #5.0.0
106+
107+
- name: Check all jobs succeeded and none missing
105108
run: |
109+
# Check if all needed jobs succeeded
106110
results='${{ toJSON(needs) }}'
107111
if echo "$results" | jq -r '.[] | .result' | grep -v success; then
108112
echo "Some jobs failed"
109113
exit 1
110114
fi
111-
echo "All CodeQL checks passed!"
115+
116+
# Extract all job names from workflow (excluding this gate job)
117+
all_jobs=$(yq eval '.jobs | keys | .[]' .github/workflows/codeql.yml | grep -v "all-codeql-checks-pass" | sort)
118+
119+
# Extract job names from needs array
120+
needed_jobs='${{ toJSON(needs) }}'
121+
needs_list=$(echo "$needed_jobs" | jq -r 'keys[]' | sort)
122+
123+
echo "All jobs in workflow: $all_jobs"
124+
echo "Jobs in needs array: $needs_list"
125+
126+
# Check if any jobs are missing from needs
127+
missing_jobs=$(comm -23 <(echo "$all_jobs") <(echo "$needs_list"))
128+
if [ -n "$missing_jobs" ]; then
129+
echo "ERROR: Jobs missing from needs array in all-codeql-checks-pass:"
130+
echo "$missing_jobs"
131+
echo "Please add these jobs to the needs array of all-codeql-checks-pass"
132+
exit 1
133+
fi
134+
135+
echo "All CodeQL checks passed and no jobs missing from gate!"

0 commit comments

Comments
 (0)