Repository navigation
Report cancelled jobs with a separate job status in init-post - #4345
Draft
henrymercer wants to merge 1 commit into
Draft
henrymercer wants to merge 1 commit into
henrymercer wants to merge 1 commit into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Human confirmation that github.com and GHE.com accept the ungated JOB_STATUS_CANCELLED API value is needed, since local unit tests cannot establish server compatibility and rejection would drop cancelled-job reports.
No open issues 🎉
1 file not reviewed
lib/entry-points.js: Excluded by your content exclusion settings
What changed in this PR
This PR makes cancellation telemetry more precise by reporting unfinished, cancelled CodeQL jobs separately from unknown statuses and configuration errors.
Changes:
- Adds
JOB_STATUS_CANCELLEDfor github.com and GHE.com, while preserving existing GHES behavior. - Preserves successful analysis results and previously reported CodeQL errors when a job is later cancelled.
- Adds unit tests for cancellation timing, status precedence, and platform compatibility.
| File | Description |
|---|---|
src/status-report.ts |
Defines the cancelled status, display name, and platform support check. |
src/init-action-post.ts |
Uses the runtime job status to classify cancellations in post-step reporting. |
src/init-action-post.test.ts |
Tests cancellation reporting, status precedence, and GHES fallback behavior. |
Review effort: Balanced (adaptive)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
initpost step reports jobs that were cancelled before the analysis completed asJOB_STATUS_UNKNOWNifinithadn't saved a configuration, and asJOB_STATUS_CONFIGURATION_ERRORif it had. This makes both statuses noisy, for example whenconcurrencygroups cancel superseded runs. The post step already receivesjob.statusthrough the internaljob-statusinput, so this uses it to report these jobs asJOB_STATUS_CANCELLEDinstead. A job that was cancelled after the analysis completed is still reported as a success, and a job where a CodeQL Action step reported an error before the cancellation still reports that error.The status report API rejects job statuses it doesn't recognise, so we only send the new status to github.com and GHE.com, and GHES keeps reporting these jobs as before. Job-level timeouts also reach the post step as cancellations, so they're reported as cancelled too.
Risk assessment
For internal use only. Please select the risk level of this change:
Which use cases does this change impact?
Workflow types:
dynamicworkflows (Default Setup, Code Quality, ...).Products:
analysis-kinds: code-scanning.analysis-kinds: code-quality.Environments:
github.comand/or GitHub Enterprise Cloud with Data Residency.How did/will you validate this change?
init-poststatus report for a cancelled run is accepted..test.tsfiles).pr-checks).If something goes wrong after this change is released, what are the mitigation and rollback strategies?
How will you know if something goes wrong after this change is released?
Are there any special considerations for merging or releasing this change?
JOB_STATUS_CANCELLEDin status reports. Otherwise, we'd lose theinit-poststatus reports for cancelled jobs, though workflows wouldn't be affected.Merge / deployment checklist