Merge branch 'main' into cklin/overlay-pack-check

This commit is contained in:
Chuan-kai Lin
2025-08-11 07:10:04 -07:00
35 changed files with 85 additions and 368 deletions
+12 -3
View File
@@ -1,5 +1,14 @@
### Risk assessment
For internal use only. Please select the risk level of this change:
- **Low risk:** Changes are fully under feature flags, or have been fully tested and validated in pre-production environments and are highly observable, or are documentation or test only.
- **High risk:** Changes are not fully under feature flags, have limited visibility and/or cannot be tested outside of production.
### Merge / deployment checklist
- [ ] Confirm this change is backwards compatible with existing workflows.
- [ ] Confirm the [readme](https://github.com/github/codeql-action/blob/main/README.md) has been updated if necessary.
- [ ] Confirm the [changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) has been updated if necessary.
- Confirm this change is backwards compatible with existing workflows.
- Consider adding a [changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) entry for this change.
- Confirm the [readme](https://github.com/github/codeql-action/blob/main/README.md) and docs have been updated if necessary.
@@ -3,7 +3,7 @@
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Extract directly to toolcache
name: 'PR Check - Bundle: Caching checks'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
@@ -22,7 +22,7 @@ on:
- cron: '0 5 * * *'
workflow_dispatch: {}
jobs:
extract-direct-to-toolcache:
bundle-toolcache:
strategy:
fail-fast: false
matrix:
@@ -33,7 +33,7 @@ jobs:
version: linked
- os: windows-latest
version: linked
name: Extract directly to toolcache
name: 'Bundle: Caching checks'
permissions:
contents: read
security-events: read
@@ -92,5 +92,4 @@ jobs:
throw new Error('Multiple CodeQL versions found in toolcache');
}
env:
CODEQL_ACTION_EXTRACT_TOOLCACHE: true
CODEQL_ACTION_TEST_MODE: true
@@ -3,7 +3,7 @@
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Zstandard bundle
name: 'PR Check - Bundle: Zstandard checks'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
@@ -22,7 +22,7 @@ on:
- cron: '0 5 * * *'
workflow_dispatch: {}
jobs:
zstd-bundle:
bundle-zstd:
strategy:
fail-fast: false
matrix:
@@ -33,7 +33,7 @@ jobs:
version: linked
- os: windows-latest
version: linked
name: Zstandard bundle
name: 'Bundle: Zstandard checks'
permissions:
contents: read
security-events: read
@@ -109,5 +109,4 @@ jobs:
);
}
env:
CODEQL_ACTION_ZSTD_BUNDLE: true
CODEQL_ACTION_TEST_MODE: true
-110
View File
@@ -1,110 +0,0 @@
# Warning: This file is generated automatically, and should not be modified.
# Instead, please modify the template in the pr-checks directory and run:
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
# to regenerate this file.
name: PR Check - Zstandard bundle (streaming)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO111MODULE: auto
on:
push:
branches:
- main
- releases/v*
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
schedule:
- cron: '0 5 * * *'
workflow_dispatch: {}
jobs:
zstd-bundle-streaming:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
version: linked
- os: ubuntu-latest
version: linked
name: Zstandard bundle (streaming)
permissions:
contents: read
security-events: read
timeout-minutes: 45
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Prepare test
id: prepare-test
uses: ./.github/actions/prepare-test
with:
version: ${{ matrix.version }}
use-all-platform-bundle: 'false'
setup-kotlin: 'true'
- name: Remove CodeQL from toolcache
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const path = require('path');
const codeqlPath = path.join(process.env['RUNNER_TOOL_CACHE'], 'CodeQL');
if (codeqlPath !== undefined) {
fs.rmdirSync(codeqlPath, { recursive: true });
}
- id: init
uses: ./../action/init
with:
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
upload-database: false
- name: Upload SARIF
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-zstd-bundle.sarif
path: ${{ runner.temp }}/results/javascript.sarif
retention-days: 7
- name: Check diagnostic with expected tools URL appears in SARIF
uses: actions/github-script@v7
env:
SARIF_PATH: ${{ runner.temp }}/results/javascript.sarif
with:
script: |
const fs = require('fs');
const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8'));
const run = sarif.runs[0];
const toolExecutionNotifications = run.invocations[0].toolExecutionNotifications;
const downloadTelemetryNotifications = toolExecutionNotifications.filter(n =>
n.descriptor.id === 'codeql-action/bundle-download-telemetry'
);
if (downloadTelemetryNotifications.length !== 1) {
core.setFailed(
'Expected exactly one reporting descriptor in the ' +
`'runs[].invocations[].toolExecutionNotifications[]' SARIF property, but found ` +
`${downloadTelemetryNotifications.length}. All notification reporting descriptors: ` +
`${JSON.stringify(toolExecutionNotifications)}.`
);
}
const toolsUrl = downloadTelemetryNotifications[0].properties.attributes.toolsUrl;
console.log(`Found tools URL: ${toolsUrl}`);
if (!toolsUrl.endsWith('.tar.zst')) {
core.setFailed(
`Expected the tools URL to be a .tar.zst file, but found ${toolsUrl}.`
);
}
env:
CODEQL_ACTION_ZSTD_BUNDLE: true
CODEQL_ACTION_ZSTD_BUNDLE_STREAMING_EXTRACTION: true
CODEQL_ACTION_TEST_MODE: true
+2 -2
View File
@@ -20,8 +20,8 @@ inputs:
default: "always"
cleanup-level:
description: >-
DEPRECATED. This option is ignored since, for performance reasons, the CodeQL Action no longer saves
intermediate results during evaluation.
DEPRECATED. This option is ignored since, for performance reasons, the CodeQL Action automatically
manages cleanup of intermediate results.
required: false
ram:
description: >-
+8 -8
View File
@@ -161,14 +161,6 @@ async function run() {
let dbCreationTimings = undefined;
let didUploadTrapCaches = false;
util.initializeEnvironment(actionsUtil.getActionVersion());
// Unset the CODEQL_PROXY_* environment variables, as they are not needed
// and can cause issues with the CodeQL CLI
// Check for CODEQL_PROXY_HOST: and if it is empty but set, unset it
if (process.env.CODEQL_PROXY_HOST === "") {
delete process.env.CODEQL_PROXY_HOST;
delete process.env.CODEQL_PROXY_PORT;
delete process.env.CODEQL_PROXY_CA_CERTIFICATE;
}
// Make inputs accessible in the `post` step, details at
// https://github.com/github/codeql-action/issues/2553
actionsUtil.persistInputs();
@@ -186,6 +178,14 @@ async function run() {
if (hasBadExpectErrorInput()) {
throw new util.ConfigurationError("`expect-error` input parameter is for internal use only. It should only be set by codeql-action or a fork.");
}
// Unset the CODEQL_PROXY_* environment variables when using older CodeQL
// CLIs, as they are not needed and can cause issues.
if (process.env.CODEQL_PROXY_HOST === "" &&
!(await util.codeQlVersionAtLeast(codeql, "2.20.7"))) {
delete process.env.CODEQL_PROXY_HOST;
delete process.env.CODEQL_PROXY_PORT;
delete process.env.CODEQL_PROXY_CA_CERTIFICATE;
}
if (actionsUtil.getOptionalInput("cleanup-level") !== "") {
logger.info("The 'cleanup-level' input is ignored since the CodeQL Action now automatically " +
"manages database cleanup. This input can safely be removed from your workflow.");
File diff suppressed because one or more lines are too long
Generated
+2 -2
View File
@@ -112,9 +112,9 @@ const CODEQL_VERSION_CACHE_CLEANUP = "2.17.1";
* version requirement. Must be set to true outside tests.
* @returns a { CodeQL, toolsVersion } object.
*/
async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger, features, checkVersion) {
async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger, checkVersion) {
try {
const { codeqlFolder, toolsDownloadStatusReport, toolsSource, toolsVersion, zstdAvailability, } = await setupCodeql.setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, features, defaultCliVersion, logger);
const { codeqlFolder, toolsDownloadStatusReport, toolsSource, toolsVersion, zstdAvailability, } = await setupCodeql.setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger);
logger.debug(`Bundle download status report: ${JSON.stringify(toolsDownloadStatusReport)}`);
let codeqlCmd = path.join(codeqlFolder, "codeql", "codeql");
if (process.platform === "win32") {
+1 -1
View File
File diff suppressed because one or more lines are too long
+10 -11
View File
@@ -61,7 +61,6 @@ const util = __importStar(require("./util"));
const util_1 = require("./util");
(0, testing_utils_1.setupTests)(ava_1.default);
let stubConfig;
const NO_FEATURES = (0, testing_utils_1.createFeatures)([]);
ava_1.default.beforeEach(() => {
(0, util_1.initializeEnvironment)("1.2.3");
stubConfig = (0, testing_utils_1.createTestConfig)({
@@ -72,7 +71,7 @@ async function installIntoToolcache({ apiDetails = testing_utils_1.SAMPLE_DOTCOM
const url = (0, testing_utils_1.mockBundleDownloadApi)({ apiDetails, isPinned, tagName });
await codeql.setupCodeQL(cliVersion !== undefined ? undefined : url, apiDetails, tmpDir, util.GitHubVariant.GHES, cliVersion !== undefined
? { cliVersion, tagName }
: testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), NO_FEATURES, false);
: testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
}
function mockReleaseApi({ apiDetails = testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, assetNames, tagName, }) {
return (0, nock_1.default)(apiDetails.apiURL)
@@ -115,7 +114,7 @@ async function stubCodeql() {
tagName: `codeql-bundle-${version}`,
isPinned: false,
});
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), NO_FEATURES, false);
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
t.assert(toolcache.find("CodeQL", `0.0.0-${version}`));
t.is(result.toolsVersion, `0.0.0-${version}`);
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
@@ -130,7 +129,7 @@ async function stubCodeql() {
tagName: `codeql-bundle-v2.15.0`,
isPinned: false,
});
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), NO_FEATURES, false);
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
t.is(toolcache.findAllVersions("CodeQL").length, 1);
t.assert(toolcache.find("CodeQL", `2.15.0`));
t.is(result.toolsVersion, `2.15.0`);
@@ -151,7 +150,7 @@ async function stubCodeql() {
const url = (0, testing_utils_1.mockBundleDownloadApi)({
tagName: "codeql-bundle-20200610",
});
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), NO_FEATURES, false);
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
t.assert(toolcache.find("CodeQL", "0.0.0-20200610"));
t.deepEqual(result.toolsVersion, "0.0.0-20200610");
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
@@ -179,7 +178,7 @@ for (const { tagName, expectedToolcacheVersion, } of EXPLICITLY_REQUESTED_BUNDLE
const url = (0, testing_utils_1.mockBundleDownloadApi)({
tagName,
});
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), NO_FEATURES, false);
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
t.assert(toolcache.find("CodeQL", expectedToolcacheVersion));
t.deepEqual(result.toolsVersion, expectedToolcacheVersion);
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
@@ -202,7 +201,7 @@ for (const toolcacheVersion of [
.withArgs("CodeQL", toolcacheVersion)
.returns("path/to/cached/codeql");
sinon.stub(toolcache, "findAllVersions").returns([toolcacheVersion]);
const result = await codeql.setupCodeQL(undefined, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), NO_FEATURES, false);
const result = await codeql.setupCodeQL(undefined, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
t.is(result.toolsVersion, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION.cliVersion);
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Toolcache);
t.is(result.toolsDownloadStatusReport?.combinedDurationMs, undefined);
@@ -222,7 +221,7 @@ for (const toolcacheVersion of [
const result = await codeql.setupCodeQL(undefined, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.GHES, {
cliVersion: defaults.cliVersion,
tagName: defaults.bundleVersion,
}, (0, logging_1.getRunnerLogger)(true), NO_FEATURES, false);
}, (0, logging_1.getRunnerLogger)(true), false);
t.deepEqual(result.toolsVersion, "0.0.0-20200601");
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Toolcache);
t.is(result.toolsDownloadStatusReport?.combinedDurationMs, undefined);
@@ -246,7 +245,7 @@ for (const toolcacheVersion of [
const result = await codeql.setupCodeQL(undefined, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.GHES, {
cliVersion: defaults.cliVersion,
tagName: defaults.bundleVersion,
}, (0, logging_1.getRunnerLogger)(true), NO_FEATURES, false);
}, (0, logging_1.getRunnerLogger)(true), false);
t.deepEqual(result.toolsVersion, defaults.cliVersion);
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
if (result.toolsDownloadStatusReport) {
@@ -267,7 +266,7 @@ for (const toolcacheVersion of [
(0, testing_utils_1.mockBundleDownloadApi)({
tagName: defaults.bundleVersion,
});
const result = await codeql.setupCodeQL("latest", testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), NO_FEATURES, false);
const result = await codeql.setupCodeQL("latest", testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
t.deepEqual(result.toolsVersion, defaults.cliVersion);
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
if (result.toolsDownloadStatusReport) {
@@ -291,7 +290,7 @@ for (const toolcacheVersion of [
platformSpecific: false,
tagName: "codeql-bundle-20230203",
});
const result = await codeql.setupCodeQL("https://github.com/codeql-testing/codeql-cli-nightlies/releases/download/codeql-bundle-20230203/codeql-bundle.tar.gz", testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), NO_FEATURES, false);
const result = await codeql.setupCodeQL("https://github.com/codeql-testing/codeql-cli-nightlies/releases/download/codeql-bundle-20230203/codeql-bundle.tar.gz", testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
t.is(result.toolsVersion, "0.0.0-20230203");
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
if (result.toolsDownloadStatusReport) {
File diff suppressed because one or more lines are too long
-12
View File
@@ -66,7 +66,6 @@ var Feature;
Feature["DisableJavaBuildlessEnabled"] = "disable_java_buildless_enabled";
Feature["DisableKotlinAnalysisEnabled"] = "disable_kotlin_analysis_enabled";
Feature["ExportDiagnosticsEnabled"] = "export_diagnostics_enabled";
Feature["ExtractToToolcache"] = "extract_to_toolcache";
Feature["OverlayAnalysis"] = "overlay_analysis";
Feature["OverlayAnalysisActions"] = "overlay_analysis_actions";
Feature["OverlayAnalysisCodeScanningActions"] = "overlay_analysis_code_scanning_actions";
@@ -91,7 +90,6 @@ var Feature;
Feature["PythonDefaultIsToNotExtractStdlib"] = "python_default_is_to_not_extract_stdlib";
Feature["QaTelemetryEnabled"] = "qa_telemetry_enabled";
Feature["RustAnalysis"] = "rust_analysis";
Feature["ZstdBundleStreamingExtraction"] = "zstd_bundle_streaming_extraction";
})(Feature || (exports.Feature = Feature = {}));
exports.featureConfig = {
[Feature.CleanupTrapCaches]: {
@@ -104,11 +102,6 @@ exports.featureConfig = {
envVar: "CODEQL_EXTRACTOR_CPP_BUILD_MODE_NONE",
minimumVersion: undefined,
},
[Feature.ZstdBundleStreamingExtraction]: {
defaultValue: false,
envVar: "CODEQL_ACTION_ZSTD_BUNDLE_STREAMING_EXTRACTION",
minimumVersion: undefined,
},
[Feature.CppDependencyInstallation]: {
defaultValue: false,
envVar: "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES",
@@ -143,11 +136,6 @@ exports.featureConfig = {
legacyApi: true,
minimumVersion: undefined,
},
[Feature.ExtractToToolcache]: {
defaultValue: false,
envVar: "CODEQL_ACTION_EXTRACT_TOOLCACHE",
minimumVersion: undefined,
},
[Feature.OverlayAnalysis]: {
defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -181,7 +181,7 @@ async function run() {
}
const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(gitHubVersion.type);
toolsFeatureFlagsValid = codeQLDefaultVersionInfo.toolsFeatureFlagsValid;
const initCodeQLResult = await (0, init_1.initCodeQL)((0, actions_util_1.getOptionalInput)("tools"), apiDetails, (0, actions_util_1.getTemporaryDirectory)(), gitHubVersion.type, codeQLDefaultVersionInfo, features, logger);
const initCodeQLResult = await (0, init_1.initCodeQL)((0, actions_util_1.getOptionalInput)("tools"), apiDetails, (0, actions_util_1.getTemporaryDirectory)(), gitHubVersion.type, codeQLDefaultVersionInfo, logger);
codeql = initCodeQLResult.codeql;
toolsDownloadStatusReport = initCodeQLResult.toolsDownloadStatusReport;
toolsVersion = initCodeQLResult.toolsVersion;
File diff suppressed because one or more lines are too long
Generated
+2 -2
View File
@@ -50,9 +50,9 @@ const configUtils = __importStar(require("./config-utils"));
const languages_1 = require("./languages");
const logging_1 = require("./logging");
const util = __importStar(require("./util"));
async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger) {
async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger) {
logger.startGroup("Setup CodeQL tools");
const { codeql, toolsDownloadStatusReport, toolsSource, toolsVersion, zstdAvailability, } = await (0, codeql_1.setupCodeQL)(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger, features, true);
const { codeql, toolsDownloadStatusReport, toolsSource, toolsVersion, zstdAvailability, } = await (0, codeql_1.setupCodeQL)(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger, true);
await codeql.printVersion();
logger.endGroup();
return {
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,gCAyCC;AA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I,IAAI,CAAC,kBAAkB,CAC/B,GAAG,KAAK,4GAA4G;oBAClH,sEAAsE,IAAI,CAAC,eAAe,CACxF,CAAC,CACF,EAAE,CACN,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CACb,GAAG,KAAK,sDAAsD;oBAC5D,+EAA+E;oBAC/E,yCAAyC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CACrE,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
+7 -30
View File
@@ -47,7 +47,6 @@ exports.getCodeQLURLVersion = getCodeQLURLVersion;
exports.setupCodeQLBundle = setupCodeQLBundle;
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const perf_hooks_1 = require("perf_hooks");
const toolcache = __importStar(require("@actions/tool-cache"));
const fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
const semver = __importStar(require("semver"));
@@ -56,7 +55,6 @@ const actions_util_1 = require("./actions-util");
const api = __importStar(require("./api-client"));
const defaults = __importStar(require("./defaults.json"));
const feature_flags_1 = require("./feature-flags");
const logging_1 = require("./logging");
const tar = __importStar(require("./tar"));
const tools_download_1 = require("./tools-download");
const util = __importStar(require("./util"));
@@ -417,7 +415,7 @@ async function tryGetFallbackToolcacheVersion(cliVersion, tagName, logger) {
}
// Exported using `export const` for testing purposes. Specifically, we want to
// be able to stub this function and have other functions in this file use that stub.
const downloadCodeQL = async function (codeqlURL, compressionMethod, maybeBundleVersion, maybeCliVersion, apiDetails, tarVersion, tempDir, features, logger) {
const downloadCodeQL = async function (codeqlURL, compressionMethod, maybeBundleVersion, maybeCliVersion, apiDetails, tarVersion, tempDir, logger) {
const parsedCodeQLURL = new URL(codeqlURL);
const searchParams = new URLSearchParams(parsedCodeQLURL.search);
const headers = {
@@ -440,11 +438,8 @@ const downloadCodeQL = async function (codeqlURL, compressionMethod, maybeBundle
logger.debug("Downloading CodeQL tools without an authorization token.");
}
const toolcacheInfo = getToolcacheDestinationInfo(maybeBundleVersion, maybeCliVersion, logger);
const extractToToolcache = !!toolcacheInfo && !!(await features.getValue(feature_flags_1.Feature.ExtractToToolcache));
const extractedBundlePath = extractToToolcache
? toolcacheInfo.path
: getTempExtractionDir(tempDir);
let statusReport = await (0, tools_download_1.downloadAndExtract)(codeqlURL, compressionMethod, extractedBundlePath, authorization, { "User-Agent": "CodeQL Action", ...headers }, tarVersion, logger);
const extractedBundlePath = toolcacheInfo?.path ?? getTempExtractionDir(tempDir);
const statusReport = await (0, tools_download_1.downloadAndExtract)(codeqlURL, compressionMethod, extractedBundlePath, authorization, { "User-Agent": "CodeQL Action", ...headers }, tarVersion, logger);
if (!toolcacheInfo) {
logger.debug("Could not cache CodeQL tools because we could not determine the bundle version from the " +
`URL ${codeqlURL}.`);
@@ -454,27 +449,9 @@ const downloadCodeQL = async function (codeqlURL, compressionMethod, maybeBundle
toolsVersion: maybeCliVersion ?? "unknown",
};
}
let codeqlFolder = extractedBundlePath;
if (extractToToolcache) {
(0, tools_download_1.writeToolcacheMarkerFile)(toolcacheInfo.path, logger);
}
else {
logger.debug("Caching CodeQL bundle.");
const toolcacheStart = perf_hooks_1.performance.now();
codeqlFolder = await toolcache.cacheDir(extractedBundlePath, "CodeQL", toolcacheInfo.version);
const cacheDurationMs = perf_hooks_1.performance.now() - toolcacheStart;
logger.info(`Added CodeQL bundle to the tool cache (${(0, logging_1.formatDuration)(cacheDurationMs)}).`);
statusReport = {
...statusReport,
cacheDurationMs,
};
// Defensive check: we expect `cacheDir` to copy the bundle to a new location.
if (codeqlFolder !== extractedBundlePath) {
await (0, util_1.cleanUpGlob)(extractedBundlePath, "CodeQL bundle from temporary directory", logger);
}
}
(0, tools_download_1.writeToolcacheMarkerFile)(toolcacheInfo.path, logger);
return {
codeqlFolder,
codeqlFolder: extractedBundlePath,
statusReport,
toolsVersion: maybeCliVersion ?? toolcacheInfo.version,
};
@@ -524,7 +501,7 @@ function getCanonicalToolcacheVersion(cliVersion, bundleVersion, logger) {
*
* @returns the path to the extracted bundle, and the version of the tools
*/
async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, features, defaultCliVersion, logger) {
async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger) {
if (!(await util.isBinaryAccessible("tar", logger))) {
throw new util.ConfigurationError("Could not find tar in PATH, so unable to extract CodeQL bundle.");
}
@@ -546,7 +523,7 @@ async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, featu
toolsSource = ToolsSource.Toolcache;
break;
case "download": {
const result = await (0, exports.downloadCodeQL)(source.codeqlURL, source.compressionMethod, source.bundleVersion, source.cliVersion, apiDetails, zstdAvailability.version, tempDir, features, logger);
const result = await (0, exports.downloadCodeQL)(source.codeqlURL, source.compressionMethod, source.bundleVersion, source.cliVersion, apiDetails, zstdAvailability.version, tempDir, logger);
toolsVersion = result.toolsVersion;
codeqlFolder = result.codeqlFolder;
toolsDownloadStatusReport = result.statusReport;
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -143,7 +143,7 @@ ava_1.default.beforeEach(() => {
});
await (0, util_1.withTmpDir)(async (tmpDir) => {
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
const result = await setupCodeql.setupCodeQLBundle("linked", testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, "tmp/codeql_action_test/", util_1.GitHubVariant.DOTCOM, expectedFeatureEnablement, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, logger);
const result = await setupCodeql.setupCodeQLBundle("linked", testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, "tmp/codeql_action_test/", util_1.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, logger);
// Basic sanity check that the version we got back is indeed
// the linked (default) CLI version.
t.is(result.toolsVersion, testing_utils_1.LINKED_CLI_VERSION.cliVersion);
@@ -174,7 +174,7 @@ ava_1.default.beforeEach(() => {
});
await (0, util_1.withTmpDir)(async (tmpDir) => {
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
const result = await setupCodeql.setupCodeQLBundle(bundleUrl, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, "tmp/codeql_action_test/", util_1.GitHubVariant.DOTCOM, expectedFeatureEnablement, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, logger);
const result = await setupCodeql.setupCodeQLBundle(bundleUrl, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, "tmp/codeql_action_test/", util_1.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, logger);
// Basic sanity check that the version we got back is indeed the version that the
// bundle contains..
t.is(result.toolsVersion, expectedVersion);
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -210,7 +210,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
};
const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(gitHubVersion.type);
const initCodeQLResult = await (0, init_1.initCodeQL)(undefined, // There is no tools input on the upload action
apiDetails, tempDir, gitHubVersion.type, codeQLDefaultVersionInfo, features, logger);
apiDetails, tempDir, gitHubVersion.type, codeQLDefaultVersionInfo, logger);
codeQL = initCodeQLResult.codeql;
}
if (!(await codeQL.supportsFeature(tools_features_1.ToolsFeature.SarifMergeRunsFromEqualCategory))) {
File diff suppressed because one or more lines are too long
@@ -1,13 +1,11 @@
name: "Extract directly to toolcache"
description: "Extract the CodeQL bundle directly into the toolcache"
name: "Bundle: Caching checks"
description: "The CodeQL bundle should be cached within the toolcache"
versions:
- linked
operatingSystems:
- macos
- ubuntu
- windows
env:
CODEQL_ACTION_EXTRACT_TOOLCACHE: true
steps:
- name: Remove CodeQL from toolcache
uses: actions/github-script@v7
@@ -1,13 +1,11 @@
name: "Zstandard bundle"
description: "Tests the feature flag that downloads a Zstandard-compressed CodeQL Bundle by default"
name: "Bundle: Zstandard checks"
description: "A Zstandard CodeQL bundle should be extracted on supported operating systems"
versions:
- linked
operatingSystems:
- macos
- ubuntu
- windows
env:
CODEQL_ACTION_ZSTD_BUNDLE: true
steps:
- name: Remove CodeQL from toolcache
uses: actions/github-script@v7
@@ -1,68 +0,0 @@
name: "Zstandard bundle (streaming)"
description: "Stream the download and extraction of a Zstandard-compressed CodeQL Bundle"
versions:
- linked
operatingSystems:
- macos
- ubuntu
env:
CODEQL_ACTION_ZSTD_BUNDLE: true
CODEQL_ACTION_ZSTD_BUNDLE_STREAMING_EXTRACTION: true
steps:
- name: Remove CodeQL from toolcache
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const path = require('path');
const codeqlPath = path.join(process.env['RUNNER_TOOL_CACHE'], 'CodeQL');
if (codeqlPath !== undefined) {
fs.rmdirSync(codeqlPath, { recursive: true });
}
- id: init
uses: ./../action/init
with:
languages: javascript
tools: ${{ steps.prepare-test.outputs.tools-url }}
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
upload-database: false
- name: Upload SARIF
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-zstd-bundle.sarif
path: ${{ runner.temp }}/results/javascript.sarif
retention-days: 7
- name: Check diagnostic with expected tools URL appears in SARIF
uses: actions/github-script@v7
env:
SARIF_PATH: ${{ runner.temp }}/results/javascript.sarif
with:
script: |
const fs = require('fs');
const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8'));
const run = sarif.runs[0];
const toolExecutionNotifications = run.invocations[0].toolExecutionNotifications;
const downloadTelemetryNotifications = toolExecutionNotifications.filter(n =>
n.descriptor.id === 'codeql-action/bundle-download-telemetry'
);
if (downloadTelemetryNotifications.length !== 1) {
core.setFailed(
'Expected exactly one reporting descriptor in the ' +
`'runs[].invocations[].toolExecutionNotifications[]' SARIF property, but found ` +
`${downloadTelemetryNotifications.length}. All notification reporting descriptors: ` +
`${JSON.stringify(toolExecutionNotifications)}.`
);
}
const toolsUrl = downloadTelemetryNotifications[0].properties.attributes.toolsUrl;
console.log(`Found tools URL: ${toolsUrl}`);
if (!toolsUrl.endsWith('.tar.zst')) {
core.setFailed(
`Expected the tools URL to be a .tar.zst file, but found ${toolsUrl}.`
);
}
+11 -9
View File
@@ -205,15 +205,6 @@ async function run() {
let didUploadTrapCaches = false;
util.initializeEnvironment(actionsUtil.getActionVersion());
// Unset the CODEQL_PROXY_* environment variables, as they are not needed
// and can cause issues with the CodeQL CLI
// Check for CODEQL_PROXY_HOST: and if it is empty but set, unset it
if (process.env.CODEQL_PROXY_HOST === "") {
delete process.env.CODEQL_PROXY_HOST;
delete process.env.CODEQL_PROXY_PORT;
delete process.env.CODEQL_PROXY_CA_CERTIFICATE;
}
// Make inputs accessible in the `post` step, details at
// https://github.com/github/codeql-action/issues/2553
actionsUtil.persistInputs();
@@ -247,6 +238,17 @@ async function run() {
);
}
// Unset the CODEQL_PROXY_* environment variables when using older CodeQL
// CLIs, as they are not needed and can cause issues.
if (
process.env.CODEQL_PROXY_HOST === "" &&
!(await util.codeQlVersionAtLeast(codeql, "2.20.7"))
) {
delete process.env.CODEQL_PROXY_HOST;
delete process.env.CODEQL_PROXY_PORT;
delete process.env.CODEQL_PROXY_CA_CERTIFICATE;
}
if (actionsUtil.getOptionalInput("cleanup-level") !== "") {
logger.info(
"The 'cleanup-level' input is ignored since the CodeQL Action now automatically " +
-13
View File
@@ -21,7 +21,6 @@ import {
} from "./config-utils";
import * as defaults from "./defaults.json";
import { DocUrl } from "./doc-url";
import { FeatureEnablement } from "./feature-flags";
import { KnownLanguage } from "./languages";
import { getRunnerLogger } from "./logging";
import { ToolsSource } from "./setup-codeql";
@@ -44,8 +43,6 @@ setupTests(test);
let stubConfig: Config;
const NO_FEATURES: FeatureEnablement = createFeatures([]);
test.beforeEach(() => {
initializeEnvironment("1.2.3");
@@ -77,7 +74,6 @@ async function installIntoToolcache({
? { cliVersion, tagName }
: SAMPLE_DEFAULT_CLI_VERSION,
getRunnerLogger(true),
NO_FEATURES,
false,
);
}
@@ -144,7 +140,6 @@ test("downloads and caches explicitly requested bundles that aren't in the toolc
util.GitHubVariant.DOTCOM,
SAMPLE_DEFAULT_CLI_VERSION,
getRunnerLogger(true),
NO_FEATURES,
false,
);
@@ -171,7 +166,6 @@ test("caches semantically versioned bundles using their semantic version number"
util.GitHubVariant.DOTCOM,
SAMPLE_DEFAULT_CLI_VERSION,
getRunnerLogger(true),
NO_FEATURES,
false,
);
@@ -205,7 +199,6 @@ test("downloads an explicitly requested bundle even if a different version is ca
util.GitHubVariant.DOTCOM,
SAMPLE_DEFAULT_CLI_VERSION,
getRunnerLogger(true),
NO_FEATURES,
false,
);
t.assert(toolcache.find("CodeQL", "0.0.0-20200610"));
@@ -250,7 +243,6 @@ for (const {
util.GitHubVariant.DOTCOM,
SAMPLE_DEFAULT_CLI_VERSION,
getRunnerLogger(true),
NO_FEATURES,
false,
);
t.assert(toolcache.find("CodeQL", expectedToolcacheVersion));
@@ -289,7 +281,6 @@ for (const toolcacheVersion of [
util.GitHubVariant.DOTCOM,
SAMPLE_DEFAULT_CLI_VERSION,
getRunnerLogger(true),
NO_FEATURES,
false,
);
t.is(result.toolsVersion, SAMPLE_DEFAULT_CLI_VERSION.cliVersion);
@@ -322,7 +313,6 @@ test(`uses a cached bundle when no tools input is given on GHES`, async (t) => {
tagName: defaults.bundleVersion,
},
getRunnerLogger(true),
NO_FEATURES,
false,
);
t.deepEqual(result.toolsVersion, "0.0.0-20200601");
@@ -359,7 +349,6 @@ test(`downloads bundle if only an unpinned version is cached on GHES`, async (t)
tagName: defaults.bundleVersion,
},
getRunnerLogger(true),
NO_FEATURES,
false,
);
t.deepEqual(result.toolsVersion, defaults.cliVersion);
@@ -393,7 +382,6 @@ test('downloads bundle if "latest" tools specified but not cached', async (t) =>
util.GitHubVariant.DOTCOM,
SAMPLE_DEFAULT_CLI_VERSION,
getRunnerLogger(true),
NO_FEATURES,
false,
);
t.deepEqual(result.toolsVersion, defaults.cliVersion);
@@ -429,7 +417,6 @@ test("bundle URL from another repo is cached as 0.0.0-bundleVersion", async (t)
util.GitHubVariant.DOTCOM,
SAMPLE_DEFAULT_CLI_VERSION,
getRunnerLogger(true),
NO_FEATURES,
false,
);
-2
View File
@@ -318,7 +318,6 @@ export async function setupCodeQL(
variant: util.GitHubVariant,
defaultCliVersion: CodeQLDefaultVersionInfo,
logger: Logger,
features: FeatureEnablement,
checkVersion: boolean,
): Promise<{
codeql: CodeQL;
@@ -339,7 +338,6 @@ export async function setupCodeQL(
apiDetails,
tempDir,
variant,
features,
defaultCliVersion,
logger,
);
-12
View File
@@ -51,7 +51,6 @@ export enum Feature {
DisableJavaBuildlessEnabled = "disable_java_buildless_enabled",
DisableKotlinAnalysisEnabled = "disable_kotlin_analysis_enabled",
ExportDiagnosticsEnabled = "export_diagnostics_enabled",
ExtractToToolcache = "extract_to_toolcache",
OverlayAnalysis = "overlay_analysis",
OverlayAnalysisActions = "overlay_analysis_actions",
OverlayAnalysisCodeScanningActions = "overlay_analysis_code_scanning_actions",
@@ -76,7 +75,6 @@ export enum Feature {
PythonDefaultIsToNotExtractStdlib = "python_default_is_to_not_extract_stdlib",
QaTelemetryEnabled = "qa_telemetry_enabled",
RustAnalysis = "rust_analysis",
ZstdBundleStreamingExtraction = "zstd_bundle_streaming_extraction",
}
export const featureConfig: Record<
@@ -120,11 +118,6 @@ export const featureConfig: Record<
envVar: "CODEQL_EXTRACTOR_CPP_BUILD_MODE_NONE",
minimumVersion: undefined,
},
[Feature.ZstdBundleStreamingExtraction]: {
defaultValue: false,
envVar: "CODEQL_ACTION_ZSTD_BUNDLE_STREAMING_EXTRACTION",
minimumVersion: undefined,
},
[Feature.CppDependencyInstallation]: {
defaultValue: false,
envVar: "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES",
@@ -159,11 +152,6 @@ export const featureConfig: Record<
legacyApi: true,
minimumVersion: undefined,
},
[Feature.ExtractToToolcache]: {
defaultValue: false,
envVar: "CODEQL_ACTION_EXTRACT_TOOLCACHE",
minimumVersion: undefined,
},
[Feature.OverlayAnalysis]: {
defaultValue: false,
envVar: "CODEQL_ACTION_OVERLAY_ANALYSIS",
-1
View File
@@ -341,7 +341,6 @@ async function run() {
getTemporaryDirectory(),
gitHubVersion.type,
codeQLDefaultVersionInfo,
features,
logger,
);
codeql = initCodeQLResult.codeql;
+1 -3
View File
@@ -9,7 +9,7 @@ import { getOptionalInput, isSelfHostedRunner } from "./actions-util";
import { GitHubApiDetails } from "./api-client";
import { CodeQL, setupCodeQL } from "./codeql";
import * as configUtils from "./config-utils";
import { CodeQLDefaultVersionInfo, FeatureEnablement } from "./feature-flags";
import { CodeQLDefaultVersionInfo } from "./feature-flags";
import { KnownLanguage, Language } from "./languages";
import { Logger, withGroupAsync } from "./logging";
import { ToolsSource } from "./setup-codeql";
@@ -23,7 +23,6 @@ export async function initCodeQL(
tempDir: string,
variant: util.GitHubVariant,
defaultCliVersion: CodeQLDefaultVersionInfo,
features: FeatureEnablement,
logger: Logger,
): Promise<{
codeql: CodeQL;
@@ -46,7 +45,6 @@ export async function initCodeQL(
variant,
defaultCliVersion,
logger,
features,
true,
);
await codeql.printVersion();
-2
View File
@@ -184,7 +184,6 @@ test("setupCodeQLBundle logs the CodeQL CLI version being used when asked to use
SAMPLE_DOTCOM_API_DETAILS,
"tmp/codeql_action_test/",
GitHubVariant.DOTCOM,
expectedFeatureEnablement,
SAMPLE_DEFAULT_CLI_VERSION,
logger,
);
@@ -235,7 +234,6 @@ test("setupCodeQLBundle logs the CodeQL CLI version being used when asked to dow
SAMPLE_DOTCOM_API_DETAILS,
"tmp/codeql_action_test/",
GitHubVariant.DOTCOM,
expectedFeatureEnablement,
SAMPLE_DEFAULT_CLI_VERSION,
logger,
);
+7 -48
View File
@@ -1,7 +1,6 @@
import * as fs from "fs";
import { OutgoingHttpHeaders } from "http";
import * as path from "path";
import { performance } from "perf_hooks";
import * as toolcache from "@actions/tool-cache";
import { default as deepEqual } from "fast-deep-equal";
@@ -14,10 +13,8 @@ import * as defaults from "./defaults.json";
import {
CODEQL_VERSION_ZSTD_BUNDLE,
CodeQLDefaultVersionInfo,
Feature,
FeatureEnablement,
} from "./feature-flags";
import { formatDuration, Logger } from "./logging";
import { Logger } from "./logging";
import * as tar from "./tar";
import {
downloadAndExtract,
@@ -26,7 +23,7 @@ import {
writeToolcacheMarkerFile,
} from "./tools-download";
import * as util from "./util";
import { cleanUpGlob, isGoodVersion } from "./util";
import { isGoodVersion } from "./util";
export enum ToolsSource {
Unknown = "UNKNOWN",
@@ -546,7 +543,6 @@ export const downloadCodeQL = async function (
apiDetails: api.GitHubApiDetails,
tarVersion: tar.TarVersion | undefined,
tempDir: string,
features: FeatureEnablement,
logger: Logger,
): Promise<{
codeqlFolder: string;
@@ -580,14 +576,11 @@ export const downloadCodeQL = async function (
maybeCliVersion,
logger,
);
const extractToToolcache =
!!toolcacheInfo && !!(await features.getValue(Feature.ExtractToToolcache));
const extractedBundlePath = extractToToolcache
? toolcacheInfo.path
: getTempExtractionDir(tempDir);
const extractedBundlePath =
toolcacheInfo?.path ?? getTempExtractionDir(tempDir);
let statusReport = await downloadAndExtract(
const statusReport = await downloadAndExtract(
codeqlURL,
compressionMethod,
extractedBundlePath,
@@ -609,42 +602,10 @@ export const downloadCodeQL = async function (
};
}
let codeqlFolder = extractedBundlePath;
if (extractToToolcache) {
writeToolcacheMarkerFile(toolcacheInfo.path, logger);
} else {
logger.debug("Caching CodeQL bundle.");
const toolcacheStart = performance.now();
codeqlFolder = await toolcache.cacheDir(
extractedBundlePath,
"CodeQL",
toolcacheInfo.version,
);
const cacheDurationMs = performance.now() - toolcacheStart;
logger.info(
`Added CodeQL bundle to the tool cache (${formatDuration(
cacheDurationMs,
)}).`,
);
statusReport = {
...statusReport,
cacheDurationMs,
};
// Defensive check: we expect `cacheDir` to copy the bundle to a new location.
if (codeqlFolder !== extractedBundlePath) {
await cleanUpGlob(
extractedBundlePath,
"CodeQL bundle from temporary directory",
logger,
);
}
}
writeToolcacheMarkerFile(toolcacheInfo.path, logger);
return {
codeqlFolder,
codeqlFolder: extractedBundlePath,
statusReport,
toolsVersion: maybeCliVersion ?? toolcacheInfo.version,
};
@@ -726,7 +687,6 @@ export async function setupCodeQLBundle(
apiDetails: api.GitHubApiDetails,
tempDir: string,
variant: util.GitHubVariant,
features: FeatureEnablement,
defaultCliVersion: CodeQLDefaultVersionInfo,
logger: Logger,
) {
@@ -776,7 +736,6 @@ export async function setupCodeQLBundle(
apiDetails,
zstdAvailability.version,
tempDir,
features,
logger,
);
toolsVersion = result.toolsVersion;
-1
View File
@@ -261,7 +261,6 @@ async function combineSarifFilesUsingCLI(
tempDir,
gitHubVersion.type,
codeQLDefaultVersionInfo,
features,
logger,
);