Skip to content

Commit 0bb18f2

Browse files
henrymercerCopilot
andcommitted
Add a PR check for per-language CodeQL bundles
Checks that a bundle containing only a single language is both trimmed and able to analyze that language. Uses the Actions bundle, since the Actions QL pack is the only one that depends on the library pack of another language, and so is the case most likely to be missing something it needs. The bundle is pinned to a specific pre-release, so this check will need updating once per-language bundles are published as part of a release. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d4c7b873-8278-4a36-b67c-6cc5ea3b2316
1 parent f65587d commit 0bb18f2

2 files changed

Lines changed: 120 additions & 0 deletions

File tree

‎.github/workflows/__per-language-bundle.yml‎

Lines changed: 86 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "Per-language bundle"
2+
description: "Tests that a CodeQL bundle containing only a single language can analyze that language"
3+
versions:
4+
- linked # Unused: this test pins `tools` to a specific per-language bundle.
5+
steps:
6+
- id: init
7+
uses: ./../action/init
8+
with:
9+
languages: actions
10+
tools: https://github.com/dsp-testing/henrymercer-codeql-cli-binaries/releases/download/codeql-bundle-20260825/codeql-bundle-actions-linux64.tar.zst
11+
- name: Check that the bundle contains only the Actions extractor
12+
env:
13+
CODEQL_PATH: ${{ steps.init.outputs.codeql-path }}
14+
run: |
15+
languages="$("$CODEQL_PATH" resolve languages --format=json | jq -r 'keys[]')"
16+
echo "Extractors in the bundle:"
17+
echo "$languages"
18+
19+
if ! echo "$languages" | grep -qx "actions"; then
20+
echo "::error::The Actions bundle does not contain the Actions extractor."
21+
exit 1
22+
fi
23+
24+
# If the bundle still contained extractors for languages we did not ask for, then it would not
25+
# have been trimmed, and this test would be silently exercising the combined bundle instead.
26+
for language in cpp csharp go java python ruby rust swift; do
27+
if echo "$languages" | grep -qx "$language"; then
28+
echo "::error::The Actions bundle also contains the ${language} extractor, so it is not trimmed."
29+
exit 1
30+
fi
31+
done
32+
- uses: ./../action/analyze
33+
with:
34+
upload-database: false

0 commit comments

Comments
 (0)