From ef93355bf8902a2392154cdd8866bf1b80b6077e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B8rn=20B=C3=B8e=20Lauvvik?= Date: Wed, 11 Nov 2026 09:13:47 +0100 Subject: [PATCH] ci(codeql): optional build-command instead of autobuild 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 --- .github/workflows/codeql.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 0b0a3d0..4a2a967 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -24,6 +24,14 @@ on: true only where that happens, and remove it again once CodeQL catches up. type: boolean default: false + build-command: + description: >- + Optional build command to run instead of CodeQL's autobuild, for + projects autobuild can't build on its own (for example Kotlin that is + compiled with an explicit `kotlin:compile` goal). CodeQL traces the + compilers this command runs. Leave empty to use autobuild. + type: string + default: '' secrets: PACKAGES_TOKEN: # Optional: only needed for projects that resolve packages from @@ -100,7 +108,14 @@ jobs: - '**/target/**' - name: Autobuild + if: inputs.build-command == '' uses: github/codeql-action/autobuild@v4.39.1 + - name: Build + if: inputs.build-command != '' + env: + BUILD_COMMAND: ${{ inputs.build-command }} + run: eval "$BUILD_COMMAND" + - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v4.39.1