Skip to content

ci: add CodeQL advanced setup to scan main and develop#220

Merged
craigpnnl merged 1 commit into
mainfrom
ci/codeql-advanced-setup
Jul 18, 2026
Merged

ci: add CodeQL advanced setup to scan main and develop#220
craigpnnl merged 1 commit into
mainfrom
ci/codeql-advanced-setup

Conversation

@craigpnnl

Copy link
Copy Markdown
Contributor

Summary

Switches gridappsd-python from GitHub's default CodeQL setup to an advanced setup (a committed .github/workflows/codeql.yml). The sole motivation is branch coverage: default setup scans only the default branch (main) and pull requests into it. It cannot be extended to also scan develop via the API (GitHub returns 422). The advanced setup workflow adds push and PR triggers for both main and develop while keeping everything else identical to what default setup was running.

What changes

  • Adds .github/workflows/codeql.yml (one file, no other repo changes).
  • Languages: actions and python, matching what default setup currently scans (verified via the code-scanning API before authoring).
  • Query suite: default, matching default setup.
  • Schedule: weekly, Monday 02:00 UTC, matching default setup.
  • Triggers: push to main, push to develop, PRs into main, PRs into develop.
  • Action versions: actions/checkout@v4 (consistent with existing repo workflows), github/codeql-action@v4 (current stable major).
  • autobuild is omitted: Python and actions (YAML) are interpreted/declarative and require no build step. CodeQL indexes them directly.

Tradeoff to review

Merging this PR disables default setup. GitHub enforces mutual exclusivity: once this workflow runs on main, default setup is deactivated automatically. This PR is a full replacement, not an addition. If the workflow under-scans (wrong languages, wrong branches), we will have traded a working scan for a broken one. The workflow was authored to match the default setup configuration exactly, plus the develop extension.

GOSS-GridAPPS-D is intentionally left on default setup and was not touched.

No secrets required

CodeQL uses the built-in GITHUB_TOKEN via security-events: write. No additional secrets or configuration needed.

Switches from GitHub default setup to an advanced setup workflow so that
CodeQL also scans the develop branch. Default setup cannot be configured
to watch a second branch (GitHub returns 422 when an extra branch is
requested via the API). The committed workflow covers the same scope that
default setup provided (languages: actions, python; query suite: default;
weekly schedule on Monday 02:00 UTC) and extends it to push and pull
requests targeting both main and develop.

autobuild is omitted: Python and actions (YAML) are interpreted or
declarative languages that do not require a compilation step. CodeQL
indexes them directly.

Action versions: actions/checkout@v4 (matches existing repo workflows),
github/codeql-action@v4 (current stable major; v3 is a maintenance track).

Note: GitHub enforces mutual exclusivity between default setup and
advanced setup. Merging this workflow to the default branch (main) and
letting it run will disable default setup automatically. A reviewer
should treat this PR as a full replacement, not an addition.

GOSS-GridAPPS-D is intentionally left on default setup as authorized.
@craigpnnl
craigpnnl merged commit 489b86e into main Jul 18, 2026
12 of 14 checks passed
@craigpnnl
craigpnnl deleted the ci/codeql-advanced-setup branch July 18, 2026 03:04
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