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 6060
6161 - name : Perform CodeQL Analysis
6262 uses : github/codeql-action/analyze@16df4fbc19aea13d921737861d6c622bf3cefe23 # v3.30.3
63+
64+ all-codeql-checks-pass :
65+ runs-on : ubuntu-latest
66+ needs : [analyze]
67+ if : always()
68+ steps :
69+ - name : Checkout to get workflow file
70+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
71+
72+ - name : Check all jobs succeeded and none missing
73+ run : |
74+ # Check if all needed jobs succeeded
75+ results='${{ toJSON(needs) }}'
76+ if echo "$results" | jq -r '.[] | .result' | grep -v success; then
77+ echo "Some jobs failed"
78+ exit 1
79+ fi
80+
81+ # Extract all job names from workflow (excluding this gate job)
82+ all_jobs=$(yq eval '.jobs | keys | .[]' .github/workflows/codeql.yml | grep -v "all-codeql-checks-pass" | sort)
83+
84+ # Extract job names from needs array
85+ needed_jobs='${{ toJSON(needs) }}'
86+ needs_list=$(echo "$needed_jobs" | jq -r 'keys[]' | sort)
87+
88+ # Check if any jobs are missing from needs
89+ missing_jobs=$(comm -23 <(echo "$all_jobs") <(echo "$needs_list"))
90+ if [ -n "$missing_jobs" ]; then
91+ echo "ERROR: Jobs missing from needs array in all-codeql-checks-pass:"
92+ echo "$missing_jobs"
93+ echo "Please add these jobs to the needs array of all-codeql-checks-pass"
94+ exit 1
95+ fi
96+
97+ echo "All CodeQL checks passed and no jobs missing from gate!"
You can’t perform that action at this time.
0 commit comments