Skip to content

Commit fb07fb0

Browse files
benvinegarclaude
andcommitted
ci: move CodeQL to advanced setup for fork PR coverage
Default setup does not analyze pull requests from forks, but the code_scanning branch ruleset on main requires a CodeQL result — so fork PRs (e.g. #134) could never satisfy the rule and were unmergeable. Advanced setup runs CodeQL from a committed workflow whose pull_request trigger fires on fork PRs (gated once by the first-time-contributor approval), restoring code-scanning coverage for outside contributors. Languages, query suite, and weekly schedule mirror the prior default setup. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 78d15d5 commit fb07fb0

2 files changed

Lines changed: 57 additions & 0 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
---
3+
4+
chore(ci): move CodeQL to advanced setup so fork PRs get code-scanning results

.github/workflows/codeql.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# CodeQL via advanced setup. We moved off default setup because default setup
2+
# does not analyze pull requests from forks, and the `code_scanning` branch
3+
# ruleset on main requires a CodeQL result — so every fork PR was unmergeable.
4+
# A workflow's pull_request trigger DOES run on fork PRs (gated once by the
5+
# repo's first-time-contributor approval), so this restores CodeQL coverage for
6+
# outside contributors. Keep languages/query-suite/schedule in sync with what
7+
# default setup ran: actions + javascript-typescript + python, default queries,
8+
# weekly schedule.
9+
name: CodeQL
10+
11+
on:
12+
push:
13+
branches: [main]
14+
pull_request:
15+
branches: [main]
16+
schedule:
17+
# Weekly, mirroring the cadence default setup used.
18+
- cron: "27 4 * * 1"
19+
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref }}
22+
cancel-in-progress: true
23+
24+
jobs:
25+
analyze:
26+
name: Analyze (${{ matrix.language }})
27+
runs-on: ubuntu-latest
28+
permissions:
29+
# Required to upload CodeQL results to the code-scanning dashboard.
30+
security-events: write
31+
# Only needed for workflows in private repos; harmless here.
32+
packages: read
33+
contents: read
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
# javascript-typescript covers both JS and TS in one analysis.
38+
language: [actions, javascript-typescript, python]
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
43+
- name: Initialize CodeQL
44+
uses: github/codeql-action/init@v3
45+
with:
46+
languages: ${{ matrix.language }}
47+
# Default query suite, matching the prior default setup.
48+
queries: ""
49+
50+
- name: Perform CodeQL Analysis
51+
uses: github/codeql-action/analyze@v3
52+
with:
53+
category: "/language:${{ matrix.language }}"

0 commit comments

Comments
 (0)