Skip to content

Commit c606252

Browse files
authored
Merge pull request #1329 from github/henrymercer/file-baseline-info-enablement
Enable file baseline information behind a feature gate
2 parents 8aff97f + 029ecc0 commit c606252

14 files changed

+253
-13
lines changed

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

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

lib/analyze.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/analyze.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.js

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.test.js

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

lib/codeql.test.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/feature-flags.js

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

lib/feature-flags.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "Export file baseline information"
2+
description: "Tests that file baseline information is exported when the feature is enabled"
3+
versions: ["nightly-latest"]
4+
steps:
5+
- uses: ./../action/init
6+
with:
7+
languages: javascript
8+
tools: ${{ steps.prepare-test.outputs.tools-url }}
9+
env:
10+
CODEQL_FILE_BASELINE_INFORMATION: true
11+
TEST_MODE: true
12+
- name: Build code
13+
shell: bash
14+
run: ./build.sh
15+
- uses: ./../action/analyze
16+
with:
17+
output: "${{ runner.temp }}/results"
18+
env:
19+
CODEQL_FILE_BASELINE_INFORMATION: true
20+
TEST_MODE: true
21+
- name: Upload SARIF
22+
uses: actions/upload-artifact@v3
23+
with:
24+
name: with-baseline-information-${{ matrix.os }}-${{ matrix.version }}.sarif.json
25+
path: "${{ runner.temp }}/results/javascript.sarif"
26+
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

src/analyze.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,8 @@ export async function runQueries(
389389
addSnippetsFlag,
390390
threadsFlag,
391391
enableDebugLogging ? "-vv" : "-v",
392-
automationDetailsId
392+
automationDetailsId,
393+
featureEnablement
393394
);
394395
}
395396

0 commit comments

Comments
 (0)