Skip to content

ci(codeql): optional build-command instead of autobuild - #17

Merged
tblauvvik merged 1 commit into
mainfrom
ci/codeql-build-command
Nov 11, 2026
Merged

tblauvvik merged 1 commit into
mainfrom
ci/codeql-build-command

Conversation

@tblauvvik

Copy link
Copy Markdown
Contributor

Adds an optional build-command input to the reusable CodeQL workflow, for projects that CodeQL's autobuild can't build on its own.

Why

Autobuild runs a plain build (e.g. mvn package). Some projects need extra goals. For example, a mixed Kotlin/Java module where Kotlin is compiled with an explicit kotlin:compile goal fails under autobuild with cannot find symbol, because javac runs before the Kotlin classes exist.

What changes

  • New input build-command (string, default '').
  • When it is set, the Autobuild step is skipped and a Build step runs the command instead. CodeQL traces the compilers it runs, as with any manual build between init and analyze.
  • The command is passed through an environment variable (eval "$BUILD_COMMAND"), not interpolated into the script.
  • When it is empty, nothing changes: autobuild runs as before. Existing callers are unaffected, and callers pinned to an older commit keep their current behaviour until they move their pin.

Example

    uses: OriginAS/origin-actions/.github/workflows/codeql.yml@<sha>
    with:
      jdk: 21
      build-command: mvn -B -DskipTests clean kotlin:compile compile

🤖 Generated with Claude Code

Some projects can't be built by CodeQL's autobuild, for example mixed Kotlin/Java builds that compile Kotlin with an explicit kotlin:compile goal. Callers can now pass build-command; CodeQL traces the compilers it runs. The command is passed through an environment variable, not interpolated into the script.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tblauvvik
tblauvvik merged commit 8992f72 into main Nov 11, 2026
2 checks passed
@tblauvvik
tblauvvik deleted the ci/codeql-build-command branch November 11, 2026 08:25
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