Repository navigation
fix(codeql): keep a clean dispatch scan when status publish 403s #2028
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
1d9c70b
6c4ed67
c92e336
3cefd2c
d51da47
26e4e80
c99d49a
e715a5e
af7c6e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -208,6 +208,36 @@ jobs: | |
| exit 0 | ||
| ;; | ||
| esac | ||
|
|
||
| expected_title="CodeQL Scan Dispatch ${TARGET_REPOSITORY}#${PR_NUMBER}@${PR_HEAD_SHA}" | ||
| expected_job="CodeQL dispatch scan (${LANGUAGE})" | ||
| runs_json="$(gh api "repos/ContextualWisdomLab/.github/actions/workflows/codeql-scan-dispatch.yml/runs?per_page=30")" | ||
| run_id="$(printf '%s' "$runs_json" | jq -r --arg title "$expected_title" --arg path ".github/workflows/codeql-scan-dispatch.yml" ' | ||
| [ | ||
| .workflow_runs[] | ||
| | select(.path == $path) | ||
| | select(.event == "repository_dispatch") | ||
| | select(.status == "completed") | ||
| | select(.display_title == $title or .name == $title) | ||
| ] | ||
| | first | ||
| | .id // empty | ||
| ')" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: this run lookup is not an authenticated receipt. Bind exact base SHA, required run/jobs, protected source/actors, scan conclusion and one unexpired SARIF artifact before consuming its job as a terminal verdict. |
||
| if [[ "$run_id" =~ ^[1-9][0-9]*$ ]]; then | ||
| jobs_json="$(gh api "repos/ContextualWisdomLab/.github/actions/runs/${run_id}/jobs?per_page=20")" | ||
| job_conclusion="$(printf '%s' "$jobs_json" | jq -r --arg name "$expected_job" ' | ||
| [.jobs[] | select(.name == $name)] | ||
| | if length == 1 then .[0].conclusion else empty end | ||
| ')" | ||
| case "$job_conclusion" in | ||
| success|failure) | ||
| echo "verdict=${job_conclusion}" >>"$GITHUB_OUTPUT" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: before consuming this conclusion, verify exact protected handler source/actors, successful |
||
| echo "Found completed CodeQL dispatch scan job for ${LANGUAGE}: ${job_conclusion}." | ||
| exit 0 | ||
| ;; | ||
| esac | ||
| fi | ||
|
|
||
| if [ "$RUN_ATTEMPT" != "1" ]; then | ||
| echo "::error::Exact CodeQL job was rerun without an authenticated terminal verdict." | ||
| exit 1 | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.