Skip to content

ci(devcontainer-features-githooks): 👷 add a CodeQL workflow with the fewest runs - #239

Closed
tomgrv wants to merge 1 commit into
developfrom
claude/codeql-minimal-runs
Closed

tomgrv wants to merge 1 commit into
developfrom
claude/codeql-minimal-runs

Conversation

@tomgrv

@tomgrv tomgrv commented Oct 22, 2026

Copy link
Copy Markdown
Owner

CodeQL currently runs through GitHub's default setup (the CodeQL / Analyze (actions) / Analyze (python) checks), which scans on every push and pull request regardless of what changed. This adds a file-based workflow, declared as a githooks stub and dogfooded, following the workflow configuration options ("Avoiding unnecessary scans of pull requests", "Scanning on a schedule").

check-codeql.yml

  • pull_request (opened, reopened, synchronize, ready_for_review) to main/develop only, with paths limited to files CodeQL can analyze (.github/workflows/**, action.yml|yaml; **/*.py in this repo). paths decides whether the workflow runs, not what is analyzed.
  • Draft PRs are skipped (job if); marking ready scans them.
  • No push trigger. A weekly schedule (Mon 04:17 UTC) and workflow_dispatch refresh the default-branch baseline the PR results are compared with.
  • build-mode: none, one job per language (Analyze (<language>), same check names as the default setup), concurrency cancels superseded runs, 15 min timeout, category: /language:<language>.
  • The CodeQL action is pinned to the commit already used for upload-sarif in validate-pr-vulnerabilities.yml.

Stub vs dogfood: the stub scans actions only (every consumer has workflows). This repo's copy adds python to the matrix and **/*.py to paths. Re-running the stub merge onto the repo copy keeps both (verified with feature-configure on a scratch repo).

Manual step needed — GitHub rejects advanced-configuration analyses while the default setup is on, and both would double the runs: turn off Default setup under Settings → Advanced Security → Code scanning → CodeQL analysis before/when merging. I can't change repository settings from here.

bats tests/ (10) passes with the pinned v3 toolchain; prettier is clean.


Generated by Claude Code

…fewest runs

check-codeql.yml replaces GitHub's default setup: pull requests to a
long-lived branch that are ready for review and touch an analyzable file
(paths), plus a weekly scan and a manual run for the baseline; nothing on
a push. build-mode none, one job per language, concurrency cancels
superseded runs. Declared as a githooks stub and dogfooded here with the
python language this repo also uses.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011utfJEcSv7pCD1sxg3ihmL
@tomgrv tomgrv closed this Oct 22, 2026
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.

2 participants