mirror of
https://github.com/github/codeql-action.git
synced 2025-12-12 02:34:39 +08:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ba4244466 | ||
|
|
a9a416c8f4 | ||
|
|
10c6bfee12 | ||
|
|
feea86eed3 | ||
|
|
2e6f8c08c1 | ||
|
|
8342844ea7 | ||
|
|
679aac1b20 | ||
|
|
de6681ceb7 | ||
|
|
f6fe5c5c70 | ||
|
|
62762170e1 | ||
|
|
e4ccfbd189 | ||
|
|
eaa61762f4 | ||
|
|
3007c1e340 | ||
|
|
4a2e8975cd |
24
.github/actions/prepare-test/action.yml
vendored
24
.github/actions/prepare-test/action.yml
vendored
@@ -23,15 +23,27 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -e # Fail this Action if `gh release list` fails.
|
set -e # Fail this Action if `gh release list` fails.
|
||||||
|
|
||||||
|
if [[ "$RUNNER_OS" == "Linux" ]]; then
|
||||||
|
artifact_name="codeql-bundle-linux64.tar.gz"
|
||||||
|
elif [[ "$RUNNER_OS" == "macOS" ]]; then
|
||||||
|
artifact_name="codeql-bundle-osx64.tar.gz"
|
||||||
|
elif [[ "$RUNNER_OS" == "Windows" ]]; then
|
||||||
|
artifact_name="codeql-bundle-win64.tar.gz"
|
||||||
|
else
|
||||||
|
echo "::error::Unrecognized OS $RUNNER_OS"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ${{ inputs.version }} == "nightly-latest" ]]; then
|
if [[ ${{ inputs.version }} == "nightly-latest" ]]; then
|
||||||
export LATEST=`gh release list --repo dsp-testing/codeql-cli-nightlies -L 1 | cut -f 3`
|
tag=`gh release list --repo dsp-testing/codeql-cli-nightlies -L 1 | cut -f 3`
|
||||||
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$LATEST/codeql-bundle.tar.gz" >> $GITHUB_OUTPUT
|
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$tag/$artifact_name" >> $GITHUB_OUTPUT
|
||||||
elif [[ ${{ inputs.version }} == *"nightly"* ]]; then
|
elif [[ ${{ inputs.version }} == *"nightly"* ]]; then
|
||||||
export VERSION=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'`
|
version=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'`
|
||||||
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-$VERSION-manual/codeql-bundle.tar.gz" >> $GITHUB_OUTPUT
|
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-$version-manual/$artifact_name" >> $GITHUB_OUTPUT
|
||||||
elif [[ ${{ inputs.version }} == *"stable"* ]]; then
|
elif [[ ${{ inputs.version }} == *"stable"* ]]; then
|
||||||
export VERSION=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'`
|
version=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'`
|
||||||
echo "tools-url=https://github.com/github/codeql-action/releases/download/codeql-bundle-$VERSION/codeql-bundle.tar.gz" >> $GITHUB_OUTPUT
|
echo "tools-url=https://github.com/github/codeql-action/releases/download/codeql-bundle-$version/$artifact_name" >> $GITHUB_OUTPUT
|
||||||
elif [[ ${{ inputs.version }} == "latest" ]]; then
|
elif [[ ${{ inputs.version }} == "latest" ]]; then
|
||||||
echo "tools-url=latest" >> $GITHUB_OUTPUT
|
echo "tools-url=latest" >> $GITHUB_OUTPUT
|
||||||
elif [[ ${{ inputs.version }} == "cached" ]]; then
|
elif [[ ${{ inputs.version }} == "cached" ]]; then
|
||||||
|
|||||||
2
.github/workflows/__test-local-codeql.yml
generated
vendored
2
.github/workflows/__test-local-codeql.yml
generated
vendored
@@ -58,7 +58,7 @@ jobs:
|
|||||||
- id: init
|
- id: init
|
||||||
uses: ./../action/init
|
uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
tools: ./codeql-bundle.tar.gz
|
tools: ./codeql-bundle-linux64.tar.gz
|
||||||
- uses: ./../action/.github/actions/setup-swift
|
- uses: ./../action/.github/actions/setup-swift
|
||||||
with:
|
with:
|
||||||
codeql-path: ${{ steps.init.outputs.codeql-path }}
|
codeql-path: ${{ steps.init.outputs.codeql-path }}
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
See the [releases page](https://github.com/github/codeql-action/releases) for the relevant changes to the CodeQL CLI and language packs.
|
See the [releases page](https://github.com/github/codeql-action/releases) for the relevant changes to the CodeQL CLI and language packs.
|
||||||
|
|
||||||
|
## 2.21.2 - 28 Jul 2023
|
||||||
|
|
||||||
|
- Update default CodeQL bundle version to 2.14.1. [#1797](https://github.com/github/codeql-action/pull/1797)
|
||||||
|
- Avoid duplicating the analysis summary within the logs. [#1811](https://github.com/github/codeql-action/pull/1811)
|
||||||
|
|
||||||
## 2.21.1 - 26 Jul 2023
|
## 2.21.1 - 26 Jul 2023
|
||||||
|
|
||||||
- Improve the handling of fatal errors from the CodeQL CLI. [#1795](https://github.com/github/codeql-action/pull/1795)
|
- Improve the handling of fatal errors from the CodeQL CLI. [#1795](https://github.com/github/codeql-action/pull/1795)
|
||||||
|
|||||||
17
lib/codeql.js
generated
17
lib/codeql.js
generated
@@ -485,12 +485,15 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
if (querySuitePaths) {
|
if (querySuitePaths) {
|
||||||
codeqlArgs.push(...querySuitePaths);
|
codeqlArgs.push(...querySuitePaths);
|
||||||
}
|
}
|
||||||
// capture stdout, which contains analysis summaries
|
// Capture the stdout, which contains the analysis summary. Don't stream it to the Actions
|
||||||
const returnState = await runTool(cmd, codeqlArgs);
|
// logs to avoid printing it twice.
|
||||||
|
const analysisSummary = await runTool(cmd, codeqlArgs, {
|
||||||
|
noStreamStdout: true,
|
||||||
|
});
|
||||||
if (shouldWorkaroundInvalidNotifications) {
|
if (shouldWorkaroundInvalidNotifications) {
|
||||||
util.fixInvalidNotificationsInFile(codeqlOutputFile, sarifFile, logger);
|
util.fixInvalidNotificationsInFile(codeqlOutputFile, sarifFile, logger);
|
||||||
}
|
}
|
||||||
return returnState;
|
return analysisSummary;
|
||||||
},
|
},
|
||||||
async databasePrintBaseline(databasePath) {
|
async databasePrintBaseline(databasePath) {
|
||||||
const codeqlArgs = [
|
const codeqlArgs = [
|
||||||
@@ -718,9 +721,13 @@ async function runTool(cmd, args = [], opts = {}) {
|
|||||||
let output = "";
|
let output = "";
|
||||||
let error = "";
|
let error = "";
|
||||||
const exitCode = await new toolrunner.ToolRunner(cmd, args, {
|
const exitCode = await new toolrunner.ToolRunner(cmd, args, {
|
||||||
|
ignoreReturnCode: true,
|
||||||
listeners: {
|
listeners: {
|
||||||
stdout: (data) => {
|
stdout: (data) => {
|
||||||
output += data.toString("utf8");
|
output += data.toString("utf8");
|
||||||
|
if (!opts.noStreamStdout) {
|
||||||
|
process.stdout.write(data);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
stderr: (data) => {
|
stderr: (data) => {
|
||||||
let readStartIndex = 0;
|
let readStartIndex = 0;
|
||||||
@@ -730,9 +737,11 @@ async function runTool(cmd, args = [], opts = {}) {
|
|||||||
readStartIndex = data.length - maxErrorSize + 1;
|
readStartIndex = data.length - maxErrorSize + 1;
|
||||||
}
|
}
|
||||||
error += data.toString("utf8", readStartIndex);
|
error += data.toString("utf8", readStartIndex);
|
||||||
|
// Mimic the standard behavior of the toolrunner by writing stderr to stdout
|
||||||
|
process.stdout.write(data);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ignoreReturnCode: true,
|
silent: true,
|
||||||
...(opts.stdin ? { input: Buffer.from(opts.stdin || "") } : {}),
|
...(opts.stdin ? { input: Buffer.from(opts.stdin || "") } : {}),
|
||||||
}).exec();
|
}).exec();
|
||||||
if (exitCode !== 0) {
|
if (exitCode !== 0) {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"bundleVersion": "codeql-bundle-v2.14.0",
|
"bundleVersion": "codeql-bundle-v2.14.1",
|
||||||
"cliVersion": "2.14.0",
|
"cliVersion": "2.14.1",
|
||||||
"priorBundleVersion": "codeql-bundle-v2.13.5",
|
"priorBundleVersion": "codeql-bundle-v2.14.0",
|
||||||
"priorCliVersion": "2.13.5"
|
"priorCliVersion": "2.14.0"
|
||||||
}
|
}
|
||||||
|
|||||||
2
node_modules/.package-lock.json
generated
vendored
2
node_modules/.package-lock.json
generated
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "codeql",
|
"name": "codeql",
|
||||||
"version": "2.21.1",
|
"version": "2.21.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "codeql",
|
"name": "codeql",
|
||||||
"version": "2.21.1",
|
"version": "2.21.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "codeql",
|
"name": "codeql",
|
||||||
"version": "2.21.1",
|
"version": "2.21.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/artifact": "^1.1.1",
|
"@actions/artifact": "^1.1.1",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "codeql",
|
"name": "codeql",
|
||||||
"version": "2.21.1",
|
"version": "2.21.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "CodeQL action",
|
"description": "CodeQL action",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ steps:
|
|||||||
- id: init
|
- id: init
|
||||||
uses: ./../action/init
|
uses: ./../action/init
|
||||||
with:
|
with:
|
||||||
tools: ./codeql-bundle.tar.gz
|
tools: ./codeql-bundle-linux64.tar.gz
|
||||||
- uses: ./../action/.github/actions/setup-swift
|
- uses: ./../action/.github/actions/setup-swift
|
||||||
with:
|
with:
|
||||||
codeql-path: ${{ steps.init.outputs.codeql-path }}
|
codeql-path: ${{ steps.init.outputs.codeql-path }}
|
||||||
|
|||||||
@@ -843,14 +843,17 @@ export async function getCodeQLForCmd(
|
|||||||
if (querySuitePaths) {
|
if (querySuitePaths) {
|
||||||
codeqlArgs.push(...querySuitePaths);
|
codeqlArgs.push(...querySuitePaths);
|
||||||
}
|
}
|
||||||
// capture stdout, which contains analysis summaries
|
// Capture the stdout, which contains the analysis summary. Don't stream it to the Actions
|
||||||
const returnState = await runTool(cmd, codeqlArgs);
|
// logs to avoid printing it twice.
|
||||||
|
const analysisSummary = await runTool(cmd, codeqlArgs, {
|
||||||
|
noStreamStdout: true,
|
||||||
|
});
|
||||||
|
|
||||||
if (shouldWorkaroundInvalidNotifications) {
|
if (shouldWorkaroundInvalidNotifications) {
|
||||||
util.fixInvalidNotificationsInFile(codeqlOutputFile, sarifFile, logger);
|
util.fixInvalidNotificationsInFile(codeqlOutputFile, sarifFile, logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
return returnState;
|
return analysisSummary;
|
||||||
},
|
},
|
||||||
async databasePrintBaseline(databasePath: string): Promise<string> {
|
async databasePrintBaseline(databasePath: string): Promise<string> {
|
||||||
const codeqlArgs = [
|
const codeqlArgs = [
|
||||||
@@ -1131,14 +1134,18 @@ const maxErrorSize = 20_000;
|
|||||||
async function runTool(
|
async function runTool(
|
||||||
cmd: string,
|
cmd: string,
|
||||||
args: string[] = [],
|
args: string[] = [],
|
||||||
opts: { stdin?: string } = {},
|
opts: { stdin?: string; noStreamStdout?: boolean } = {},
|
||||||
) {
|
) {
|
||||||
let output = "";
|
let output = "";
|
||||||
let error = "";
|
let error = "";
|
||||||
const exitCode = await new toolrunner.ToolRunner(cmd, args, {
|
const exitCode = await new toolrunner.ToolRunner(cmd, args, {
|
||||||
|
ignoreReturnCode: true,
|
||||||
listeners: {
|
listeners: {
|
||||||
stdout: (data: Buffer) => {
|
stdout: (data: Buffer) => {
|
||||||
output += data.toString("utf8");
|
output += data.toString("utf8");
|
||||||
|
if (!opts.noStreamStdout) {
|
||||||
|
process.stdout.write(data);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
stderr: (data: Buffer) => {
|
stderr: (data: Buffer) => {
|
||||||
let readStartIndex = 0;
|
let readStartIndex = 0;
|
||||||
@@ -1148,9 +1155,11 @@ async function runTool(
|
|||||||
readStartIndex = data.length - maxErrorSize + 1;
|
readStartIndex = data.length - maxErrorSize + 1;
|
||||||
}
|
}
|
||||||
error += data.toString("utf8", readStartIndex);
|
error += data.toString("utf8", readStartIndex);
|
||||||
|
// Mimic the standard behavior of the toolrunner by writing stderr to stdout
|
||||||
|
process.stdout.write(data);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ignoreReturnCode: true,
|
silent: true,
|
||||||
...(opts.stdin ? { input: Buffer.from(opts.stdin || "") } : {}),
|
...(opts.stdin ? { input: Buffer.from(opts.stdin || "") } : {}),
|
||||||
}).exec();
|
}).exec();
|
||||||
if (exitCode !== 0) {
|
if (exitCode !== 0) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"bundleVersion": "codeql-bundle-v2.14.0",
|
"bundleVersion": "codeql-bundle-v2.14.1",
|
||||||
"cliVersion": "2.14.0",
|
"cliVersion": "2.14.1",
|
||||||
"priorBundleVersion": "codeql-bundle-v2.13.5",
|
"priorBundleVersion": "codeql-bundle-v2.14.0",
|
||||||
"priorCliVersion": "2.13.5"
|
"priorCliVersion": "2.14.0"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user