Skip to content

Commit 0ba4244

Browse files
authored
Merge pull request #1813 from github/update-v2.21.2-10c6bfee1
Merge main into releases/v2
2 parents 6ca1aa8 + a9a416c commit 0ba4244

File tree

12 files changed

+65
-30
lines changed

12 files changed

+65
-30
lines changed

.github/actions/prepare-test/action.yml

+18-6
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,27 @@ runs:
2323
shell: bash
2424
run: |
2525
set -e # Fail this Action if `gh release list` fails.
26+
27+
if [[ "$RUNNER_OS" == "Linux" ]]; then
28+
artifact_name="codeql-bundle-linux64.tar.gz"
29+
elif [[ "$RUNNER_OS" == "macOS" ]]; then
30+
artifact_name="codeql-bundle-osx64.tar.gz"
31+
elif [[ "$RUNNER_OS" == "Windows" ]]; then
32+
artifact_name="codeql-bundle-win64.tar.gz"
33+
else
34+
echo "::error::Unrecognized OS $RUNNER_OS"
35+
exit 1
36+
fi
37+
2638
if [[ ${{ inputs.version }} == "nightly-latest" ]]; then
27-
export LATEST=`gh release list --repo dsp-testing/codeql-cli-nightlies -L 1 | cut -f 3`
28-
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$LATEST/codeql-bundle.tar.gz" >> $GITHUB_OUTPUT
39+
tag=`gh release list --repo dsp-testing/codeql-cli-nightlies -L 1 | cut -f 3`
40+
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$tag/$artifact_name" >> $GITHUB_OUTPUT
2941
elif [[ ${{ inputs.version }} == *"nightly"* ]]; then
30-
export VERSION=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'`
31-
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-$VERSION-manual/codeql-bundle.tar.gz" >> $GITHUB_OUTPUT
42+
version=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'`
43+
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-$version-manual/$artifact_name" >> $GITHUB_OUTPUT
3244
elif [[ ${{ inputs.version }} == *"stable"* ]]; then
33-
export VERSION=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'`
34-
echo "tools-url=https://github.com/github/codeql-action/releases/download/codeql-bundle-$VERSION/codeql-bundle.tar.gz" >> $GITHUB_OUTPUT
45+
version=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'`
46+
echo "tools-url=https://github.com/github/codeql-action/releases/download/codeql-bundle-$version/$artifact_name" >> $GITHUB_OUTPUT
3547
elif [[ ${{ inputs.version }} == "latest" ]]; then
3648
echo "tools-url=latest" >> $GITHUB_OUTPUT
3749
elif [[ ${{ inputs.version }} == "cached" ]]; then

.github/workflows/__test-local-codeql.yml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
See the [releases page](https://github.com/github/codeql-action/releases) for the relevant changes to the CodeQL CLI and language packs.
44

5+
## 2.21.2 - 28 Jul 2023
6+
7+
- Update default CodeQL bundle version to 2.14.1. [#1797](https://github.com/github/codeql-action/pull/1797)
8+
- Avoid duplicating the analysis summary within the logs. [#1811](https://github.com/github/codeql-action/pull/1811)
9+
510
## 2.21.1 - 26 Jul 2023
611

712
- Improve the handling of fatal errors from the CodeQL CLI. [#1795](https://github.com/github/codeql-action/pull/1795)

lib/codeql.js

+13-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/defaults.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"bundleVersion": "codeql-bundle-v2.14.0",
3-
"cliVersion": "2.14.0",
4-
"priorBundleVersion": "codeql-bundle-v2.13.5",
5-
"priorCliVersion": "2.13.5"
2+
"bundleVersion": "codeql-bundle-v2.14.1",
3+
"cliVersion": "2.14.1",
4+
"priorBundleVersion": "codeql-bundle-v2.14.0",
5+
"priorCliVersion": "2.14.0"
66
}

node_modules/.package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codeql",
3-
"version": "2.21.1",
3+
"version": "2.21.2",
44
"private": true,
55
"description": "CodeQL action",
66
"scripts": {

pr-checks/checks/test-local-codeql.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ steps:
1212
- id: init
1313
uses: ./../action/init
1414
with:
15-
tools: ./codeql-bundle.tar.gz
15+
tools: ./codeql-bundle-linux64.tar.gz
1616
- uses: ./../action/.github/actions/setup-swift
1717
with:
1818
codeql-path: ${{ steps.init.outputs.codeql-path }}

src/codeql.ts

+14-5
Original file line numberDiff line numberDiff line change
@@ -843,14 +843,17 @@ export async function getCodeQLForCmd(
843843
if (querySuitePaths) {
844844
codeqlArgs.push(...querySuitePaths);
845845
}
846-
// capture stdout, which contains analysis summaries
847-
const returnState = await runTool(cmd, codeqlArgs);
846+
// Capture the stdout, which contains the analysis summary. Don't stream it to the Actions
847+
// logs to avoid printing it twice.
848+
const analysisSummary = await runTool(cmd, codeqlArgs, {
849+
noStreamStdout: true,
850+
});
848851

849852
if (shouldWorkaroundInvalidNotifications) {
850853
util.fixInvalidNotificationsInFile(codeqlOutputFile, sarifFile, logger);
851854
}
852855

853-
return returnState;
856+
return analysisSummary;
854857
},
855858
async databasePrintBaseline(databasePath: string): Promise<string> {
856859
const codeqlArgs = [
@@ -1131,14 +1134,18 @@ const maxErrorSize = 20_000;
11311134
async function runTool(
11321135
cmd: string,
11331136
args: string[] = [],
1134-
opts: { stdin?: string } = {},
1137+
opts: { stdin?: string; noStreamStdout?: boolean } = {},
11351138
) {
11361139
let output = "";
11371140
let error = "";
11381141
const exitCode = await new toolrunner.ToolRunner(cmd, args, {
1142+
ignoreReturnCode: true,
11391143
listeners: {
11401144
stdout: (data: Buffer) => {
11411145
output += data.toString("utf8");
1146+
if (!opts.noStreamStdout) {
1147+
process.stdout.write(data);
1148+
}
11421149
},
11431150
stderr: (data: Buffer) => {
11441151
let readStartIndex = 0;
@@ -1148,9 +1155,11 @@ async function runTool(
11481155
readStartIndex = data.length - maxErrorSize + 1;
11491156
}
11501157
error += data.toString("utf8", readStartIndex);
1158+
// Mimic the standard behavior of the toolrunner by writing stderr to stdout
1159+
process.stdout.write(data);
11511160
},
11521161
},
1153-
ignoreReturnCode: true,
1162+
silent: true,
11541163
...(opts.stdin ? { input: Buffer.from(opts.stdin || "") } : {}),
11551164
}).exec();
11561165
if (exitCode !== 0) {

src/defaults.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"bundleVersion": "codeql-bundle-v2.14.0",
3-
"cliVersion": "2.14.0",
4-
"priorBundleVersion": "codeql-bundle-v2.13.5",
5-
"priorCliVersion": "2.13.5"
2+
"bundleVersion": "codeql-bundle-v2.14.1",
3+
"cliVersion": "2.14.1",
4+
"priorBundleVersion": "codeql-bundle-v2.14.0",
5+
"priorCliVersion": "2.14.0"
66
}

0 commit comments

Comments
 (0)