Skip to content

Run CodeQL on pull requests from forks - #223

Closed
samdev-7 wants to merge 1 commit into
mainfrom
samliu/codeql-advanced-setup
Closed

samdev-7 wants to merge 1 commit into
mainfrom
samliu/codeql-advanced-setup

Conversation

@samdev-7

Copy link
Copy Markdown
Member

CodeQL never ran on pull requests from forks, so three required checks never reported on them.

The problem

The change

Adds .github/workflows/codeql.yml, a CodeQL advanced-setup workflow. It keeps what default setup was doing:

  • Languages: actions, javascript-typescript and ruby, with build-mode: none. These are the same as default setup, taken from its run logs.
  • Categories: /language:<language>, the same as default setup, so existing alerts carry over.
  • Job names: Analyze (<language>), so they still match the required checks.
  • Triggers:
    • pull requests to main, including from forks;
    • pushes to main;
    • a weekly schedule.

actionlint passes on all six workflows. Brakeman's SARIF upload already works from fork pull requests here (the Brakeman check shows up on #219), so CodeQL's upload should work the same way. Step 5 below confirms that.

Rollout (order matters)

GitHub rejects advanced-setup results while default setup is turned on, so this pull request's own CodeQL jobs will fail until step 2.

  1. Review this pull request.
  2. A repository admin turns off CodeQL default setup: Settings → Code security → Code scanning → CodeQL analysis → ⋯ → Disable CodeQL. Don't delete the existing alerts.
  3. Re-run the failed CodeQL jobs on this pull request and confirm all three Analyze checks pass.
  4. Merge.
  5. Confirm on a fork pull request: push to Let staff send an already-sent message to people who joined its audience since #219, or close and reopen it, and check that all three Analyze checks run and pass.

While steps 2–4 are in progress, other open pull requests won't get CodeQL results. Re-run or push to them after merging.

Not changed

  • brakeman.yml sets continue-on-error: true, so the required Brakeman Scan check can't fail. Brakeman still blocks merges through CI's scan_ruby.
  • Brakeman and RuboCop each run twice: once in their own workflows and again in ci.yml.

The repository used CodeQL default setup, which never ran on pull requests
from forks. Branch protection requires the Analyze (actions),
Analyze (javascript-typescript) and Analyze (ruby) checks, so fork pull
requests could only merge with an admin bypass.

Switch to an advanced-setup workflow with the same languages, build mode
and categories, so existing alerts carry over and the required check names
stay the same. Default setup must be disabled when this merges.
@samdev-7
samdev-7 requested a review from leowilkin as a code owner October 22, 2026 04:33
@samdev-7 samdev-7 closed this Oct 22, 2026
@samdev-7
samdev-7 deleted the samliu/codeql-advanced-setup branch October 22, 2026 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant