Skip to content

gh: Add a codeql-build-mode input to CodeQL workflows#314

Merged
azazeal merged 1 commit intomainfrom
panos/codeql-build-mode
May 5, 2026
Merged

gh: Add a codeql-build-mode input to CodeQL workflows#314
azazeal merged 1 commit intomainfrom
panos/codeql-build-mode

Conversation

@azazeal
Copy link
Copy Markdown
Contributor

@azazeal azazeal commented May 5, 2026

This PR adds a codeql-build-mode input to codeql-analysis.yml, goCI.yml, and code-scan.yml so callers can pick a CodeQL build mode (e.g. autobuild, manual, none) without forking these workflows.

The default is the empty string, which codeql-action's getOptionalInput treats as undefined — so existing callers see no behavior change. Callers that want to opt out of codeql-action's autobuild fallback (which detects a Makefile and runs make, even when codeql-build-cmd is set to a no-op) can now pass codeql-build-mode: 'manual' and provide their own Go-only build via codeql-build-cmd: 'go build ./...'.

The input name keeps the codeql- prefix used by the other CodeQL inputs (codeql-build-cmd, codeql-make-bootstrap); it's mapped to the action's unprefixed build-mode input only at the codeql-analysis.yml layer.

It also gates the Build step so it only runs when the selected mode expects a manual build — i.e. when codeql-build-mode is '' (legacy back-compat) or 'manual'. For 'autobuild' and 'none' the build is handled by codeql-action itself, so the manual CODEQL_BUILD_CMD would be redundant or conflicting.

@azazeal azazeal requested a review from dopey May 5, 2026 18:05
@azazeal azazeal marked this pull request as ready for review May 5, 2026 18:05
@azazeal azazeal requested a review from a team as a code owner May 5, 2026 18:05
@azazeal azazeal requested a review from Copilot May 5, 2026 18:05
dopey
dopey previously approved these changes May 5, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new reusable-workflow input to let callers control CodeQL’s build-mode (e.g., disabling autobuild to support source-only analysis or prevent unintended make runs) without forking the workflows.

Changes:

  • Introduces a codeql-build-mode workflow_call input to codeql-analysis.yml, goCI.yml, and code-scan.yml.
  • Wires the new input through workflow layers, mapping codeql-build-mode → CodeQL action build-mode in codeql-analysis.yml.
  • Exposes codeql-build-cmd/codeql-build-mode passthrough on code-scan.yml when calling codeql-analysis.yml.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/goCI.yml Adds codeql-build-mode input and forwards it to the reusable CodeQL workflow.
.github/workflows/codeql-analysis.yml Adds codeql-build-mode input and passes it to github/codeql-action/init as build-mode.
.github/workflows/code-scan.yml Adds codeql-build-mode (and exposes codeql-build-cmd) and forwards both to codeql-analysis.yml.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/codeql-analysis.yml
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/codeql-analysis.yml Outdated
@azazeal azazeal force-pushed the panos/codeql-build-mode branch from 6029b0e to bf2b42e Compare May 5, 2026 18:16
@azazeal azazeal requested a review from Copilot May 5, 2026 18:16
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@azazeal azazeal enabled auto-merge May 5, 2026 18:21
@azazeal azazeal merged commit 8d3e620 into main May 5, 2026
11 checks passed
@azazeal azazeal deleted the panos/codeql-build-mode branch May 5, 2026 18:34
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.

4 participants