ci: restore advanced CodeQL setup so fork PRs are not blocked - #633
Merged
Kateřina Churanová (kate-shine) merged 2 commits intoAug 3, 2026
Merged
Conversation
CodeQL default setup never runs for pull requests from forks. The code-scanning merge-protection rule therefore waits forever on a check that will never report, and fork PRs (for example #624) can never merge. Advanced setup triggered by `pull_request` does run for fork PRs, and GitHub accepts the SARIF upload on public repositories. Verified against prettier/prettier, which uses advanced setup: fork PR head bf2849ce had no `dynamic` run at all, yet github-advanced-security reported the `CodeQL` check as successful from the `pull_request` codeql.yml run. This restores .github/workflows/codeql.yml, which has been in the `disabled_manually` state since 2026-01-22 and so has not run since, despite continued dependency maintenance. Changes: - Document why advanced setup is preferred, so this is not silently reverted to default setup again. - Add the `merge_group` trigger, which main.yml and anvil-pr.yml already have and codeql.yml was missing; without it the merge queue stalls. - Bump github/codeql-action to v4.37.3 (verified immutable). Note: landing this file is not sufficient on its own. A repository admin must first disable CodeQL default setup, then re-enable this workflow, otherwise GitHub keeps it disabled. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot started reviewing on behalf of
Kateřina Churanová (kate-shine)
August 3, 2026 09:39
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Restores/modernizes the repository’s advanced CodeQL workflow configuration so CodeQL can run on events (including fork PRs and merge queue) where default setup won’t produce the required CodeQL check, preventing merge-protection from blocking indefinitely.
Changes:
- Adds an explicit rationale comment documenting why advanced CodeQL setup is required for fork PR mergeability.
- Adds the
merge_grouptrigger to support merge queue usage. - Bumps
github/codeql-actionusage tov4.37.3(init/analyze), maintaining the “immutable release tag” rationale.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #633 +/- ##
=======================================
Coverage 100.0% 100.0%
=======================================
Files 473 473
Lines 45493 45493
=======================================
Hits 45493 45493 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
martin-kolinek
approved these changes
Aug 3, 2026
Sander Saares (sandersaares)
approved these changes
Aug 3, 2026
Kateřina Churanová (kate-shine)
marked this pull request as ready for review
August 3, 2026 10:14
Kateřina Churanová (kate-shine)
enabled auto-merge (squash)
August 3, 2026 10:14
Copilot started reviewing on behalf of
Kateřina Churanová (kate-shine)
August 3, 2026 14:47
View session
Kateřina Churanová (kate-shine)
deleted the
kchuranov/codeql-advanced-fork-prs
branch
August 3, 2026 20:03
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.
Problem
Pull requests from forks can never merge. They sit forever on:
Current example: #624 (from
sandersaares/oxidizer).Root cause: this repo uses CodeQL default setup, and default setup does not run for pull requests from forks — that exclusion is documented behaviour, not a bug. The code-scanning merge-protection rule still expects a
CodeQLresult, so the check stays pending indefinitely and the PR is permanently blocked.Evidence gathered on this repo:
microsoft/oxidizersandersaares/oxidizerkate-shine/oxidizerWhy advanced setup fixes it
An advanced-setup workflow triggered by
pull_requestdoes run for fork PRs, and GitHub accepts its SARIF upload on public repositories even though the fork'sGITHUB_TOKENis read-only.Verified empirically against
prettier/prettier, a public repo on advanced setup. On fork PR headbf2849cee9d467aedf3fbd42a95201ea4393f855(fromsplincode/prettier):pull_requestones, including.github/workflows/codeql.yml; there is nodynamic(default setup) run at all;github-advanced-securityposted checkCodeQLwith conclusionsuccess.History
.github/workflows/codeql.ymlalready exists and is correct, but it has been in thedisabled_manuallystate since 2026-01-22 and has not run since.It was introduced by #219 ("ci: Switch to advanced CodeQL mode"), whose stated goal was, verbatim, "Once this is checked in, then we can tweak to improve permissions on forks" — exactly the problem above. It ran 33 times, all successful, and roughly 4.5 hours after that PR merged, default setup was switched back on in the repository settings, which automatically disabled this workflow. No PR, issue or comment records a reason. Since then #232, #237, #462, #470, #484, #543, #563 and #574 have all been maintaining a workflow that never runs.
Changes
merge_grouptrigger.main.ymlandanvil-pr.ymlboth have it andcodeql.ymldid not; without it the merge queue stalls on this workflow once it is required.github/codeql-actiontov4.37.3(confirmed"immutable": truevia the releases API, consistent with the existing tag-pinning rationale in the file).Required admin action, this PR alone is not sufficient
Merging this changes nothing by itself, because the workflow is still disabled and GitHub will keep it disabled while default setup is on. A repository admin must, in this order:
gh api -X PUT repos/microsoft/oxidizer/actions/workflows/codeql.yml/enable.Doing step 2 first does not work.
Trade-off
Fork PRs from first-time contributors will show CodeQL as
action_requireduntil a maintainer clicks "Approve and run". That is standard GitHub Actions fork policy and it also applies to every otherpull_requestworkflow in this repo today. It is a single click, versus the current situation where fork PRs cannot merge at all.Draft
Left as a draft until an admin confirms they will make the settings change, since merging without it is a no-op.