Skip to content

Commit 029ecc0

Browse files
committed
Check expected SARIF notification objects
1 parent b9b7d9f commit 029ecc0

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

.github/workflows/__export-file-baseline-information.yml

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pr-checks/checks/export-file-baseline-information.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
name: "Export file baseline information"
2-
description: "Tests that exporting file baseline information works"
2+
description: "Tests that file baseline information is exported when the feature is enabled"
33
versions: ["nightly-latest"]
44
steps:
55
- uses: ./../action/init
66
with:
7+
languages: javascript
78
tools: ${{ steps.prepare-test.outputs.tools-url }}
89
env:
910
CODEQL_FILE_BASELINE_INFORMATION: true
@@ -23,3 +24,20 @@ steps:
2324
name: with-baseline-information-${{ matrix.os }}-${{ matrix.version }}.sarif.json
2425
path: "${{ runner.temp }}/results/javascript.sarif"
2526
retention-days: 7
27+
- name: Check results
28+
shell: bash
29+
run: |
30+
cd "$RUNNER_TEMP/results"
31+
expected_baseline_languages="cpp csharp go java js python ruby"
32+
33+
for lang in ${expected_baseline_languages}; do
34+
rule_name="${lang}/baseline/expected-extracted-files"
35+
found_notification=$(jq --arg rule_name "${rule_name}" '[.runs[0].tool.driver.notifications |
36+
select(. != null) | flatten | .[].id] | any(. == $rule_name)' javascript.sarif)
37+
if [[ "${found_notification}" != "true" ]]; then
38+
echo "Expected SARIF output to contain notification '${rule_name}', but found no such notification."
39+
exit 1
40+
else
41+
echo "Found notification '${rule_name}'."
42+
fi
43+
done

0 commit comments

Comments
 (0)