File tree Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Original file line number Diff line number Diff 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!"
You can’t perform that action at this time.
0 commit comments