From 50fc7e92364bd020436526d367fe64dc7f3eaf3e Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Tue, 23 Sep 2025 14:53:29 +0200 Subject: [PATCH] Fix `tools: linked` log message --- lib/analyze-action.js | 20 +++++++--------- lib/init-action-post.js | 20 +++++++--------- lib/init-action.js | 20 +++++++--------- lib/upload-lib.js | 20 +++++++--------- lib/upload-sarif-action.js | 20 +++++++--------- src/setup-codeql.ts | 49 +++++++++++++++++++------------------- 6 files changed, 69 insertions(+), 80 deletions(-) diff --git a/lib/analyze-action.js b/lib/analyze-action.js index 9ec4e5c9a9..129f5cd894 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -92219,17 +92219,6 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian toolsVersion: "local" }; } - const forceShippedTools = toolsInput && CODEQL_BUNDLE_VERSION_ALIAS.includes(toolsInput); - if (forceShippedTools) { - logger.info( - `'tools: ${toolsInput}' was requested, so using CodeQL version ${defaultCliVersion.cliVersion}, the version shipped with the Action.` - ); - if (toolsInput === "latest") { - logger.warning( - "`tools: latest` has been renamed to `tools: linked`, but the old name is still supported. No action is required." - ); - } - } let cliVersion2; let tagName; let url2; @@ -92239,9 +92228,18 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian ); toolsInput = await getNightlyToolsUrl(logger); } + const forceShippedTools = toolsInput && CODEQL_BUNDLE_VERSION_ALIAS.includes(toolsInput); if (forceShippedTools) { cliVersion2 = cliVersion; tagName = bundleVersion; + logger.info( + `'tools: ${toolsInput}' was requested, so using CodeQL version ${cliVersion2}, the version shipped with the Action.` + ); + if (toolsInput === "latest") { + logger.warning( + "`tools: latest` has been renamed to `tools: linked`, but the old name is still supported. No action is required." + ); + } } else if (toolsInput !== void 0) { tagName = tryGetTagNameFromUrl(toolsInput, logger); url2 = toolsInput; diff --git a/lib/init-action-post.js b/lib/init-action-post.js index 9f5ee320db..5bbbca2029 100644 --- a/lib/init-action-post.js +++ b/lib/init-action-post.js @@ -130162,17 +130162,6 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian toolsVersion: "local" }; } - const forceShippedTools = toolsInput && CODEQL_BUNDLE_VERSION_ALIAS.includes(toolsInput); - if (forceShippedTools) { - logger.info( - `'tools: ${toolsInput}' was requested, so using CodeQL version ${defaultCliVersion.cliVersion}, the version shipped with the Action.` - ); - if (toolsInput === "latest") { - logger.warning( - "`tools: latest` has been renamed to `tools: linked`, but the old name is still supported. No action is required." - ); - } - } let cliVersion2; let tagName; let url2; @@ -130182,9 +130171,18 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian ); toolsInput = await getNightlyToolsUrl(logger); } + const forceShippedTools = toolsInput && CODEQL_BUNDLE_VERSION_ALIAS.includes(toolsInput); if (forceShippedTools) { cliVersion2 = cliVersion; tagName = bundleVersion; + logger.info( + `'tools: ${toolsInput}' was requested, so using CodeQL version ${cliVersion2}, the version shipped with the Action.` + ); + if (toolsInput === "latest") { + logger.warning( + "`tools: latest` has been renamed to `tools: linked`, but the old name is still supported. No action is required." + ); + } } else if (toolsInput !== void 0) { tagName = tryGetTagNameFromUrl(toolsInput, logger); url2 = toolsInput; diff --git a/lib/init-action.js b/lib/init-action.js index 0794a537d3..54629c8d8d 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -88991,17 +88991,6 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian toolsVersion: "local" }; } - const forceShippedTools = toolsInput && CODEQL_BUNDLE_VERSION_ALIAS.includes(toolsInput); - if (forceShippedTools) { - logger.info( - `'tools: ${toolsInput}' was requested, so using CodeQL version ${defaultCliVersion.cliVersion}, the version shipped with the Action.` - ); - if (toolsInput === "latest") { - logger.warning( - "`tools: latest` has been renamed to `tools: linked`, but the old name is still supported. No action is required." - ); - } - } let cliVersion2; let tagName; let url; @@ -89011,9 +89000,18 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian ); toolsInput = await getNightlyToolsUrl(logger); } + const forceShippedTools = toolsInput && CODEQL_BUNDLE_VERSION_ALIAS.includes(toolsInput); if (forceShippedTools) { cliVersion2 = cliVersion; tagName = bundleVersion; + logger.info( + `'tools: ${toolsInput}' was requested, so using CodeQL version ${cliVersion2}, the version shipped with the Action.` + ); + if (toolsInput === "latest") { + logger.warning( + "`tools: latest` has been renamed to `tools: linked`, but the old name is still supported. No action is required." + ); + } } else if (toolsInput !== void 0) { tagName = tryGetTagNameFromUrl(toolsInput, logger); url = toolsInput; diff --git a/lib/upload-lib.js b/lib/upload-lib.js index 712684630f..ef4ae60b62 100644 --- a/lib/upload-lib.js +++ b/lib/upload-lib.js @@ -89990,17 +89990,6 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian toolsVersion: "local" }; } - const forceShippedTools = toolsInput && CODEQL_BUNDLE_VERSION_ALIAS.includes(toolsInput); - if (forceShippedTools) { - logger.info( - `'tools: ${toolsInput}' was requested, so using CodeQL version ${defaultCliVersion.cliVersion}, the version shipped with the Action.` - ); - if (toolsInput === "latest") { - logger.warning( - "`tools: latest` has been renamed to `tools: linked`, but the old name is still supported. No action is required." - ); - } - } let cliVersion2; let tagName; let url2; @@ -90010,9 +89999,18 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian ); toolsInput = await getNightlyToolsUrl(logger); } + const forceShippedTools = toolsInput && CODEQL_BUNDLE_VERSION_ALIAS.includes(toolsInput); if (forceShippedTools) { cliVersion2 = cliVersion; tagName = bundleVersion; + logger.info( + `'tools: ${toolsInput}' was requested, so using CodeQL version ${cliVersion2}, the version shipped with the Action.` + ); + if (toolsInput === "latest") { + logger.warning( + "`tools: latest` has been renamed to `tools: linked`, but the old name is still supported. No action is required." + ); + } } else if (toolsInput !== void 0) { tagName = tryGetTagNameFromUrl(toolsInput, logger); url2 = toolsInput; diff --git a/lib/upload-sarif-action.js b/lib/upload-sarif-action.js index 6e83644638..f179541d5e 100644 --- a/lib/upload-sarif-action.js +++ b/lib/upload-sarif-action.js @@ -90691,17 +90691,6 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian toolsVersion: "local" }; } - const forceShippedTools = toolsInput && CODEQL_BUNDLE_VERSION_ALIAS.includes(toolsInput); - if (forceShippedTools) { - logger.info( - `'tools: ${toolsInput}' was requested, so using CodeQL version ${defaultCliVersion.cliVersion}, the version shipped with the Action.` - ); - if (toolsInput === "latest") { - logger.warning( - "`tools: latest` has been renamed to `tools: linked`, but the old name is still supported. No action is required." - ); - } - } let cliVersion2; let tagName; let url2; @@ -90711,9 +90700,18 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian ); toolsInput = await getNightlyToolsUrl(logger); } + const forceShippedTools = toolsInput && CODEQL_BUNDLE_VERSION_ALIAS.includes(toolsInput); if (forceShippedTools) { cliVersion2 = cliVersion; tagName = bundleVersion; + logger.info( + `'tools: ${toolsInput}' was requested, so using CodeQL version ${cliVersion2}, the version shipped with the Action.` + ); + if (toolsInput === "latest") { + logger.warning( + "`tools: latest` has been renamed to `tools: linked`, but the old name is still supported. No action is required." + ); + } } else if (toolsInput !== void 0) { tagName = tryGetTagNameFromUrl(toolsInput, logger); url2 = toolsInput; diff --git a/src/setup-codeql.ts b/src/setup-codeql.ts index 5a0f671fa5..a387a8b7ea 100644 --- a/src/setup-codeql.ts +++ b/src/setup-codeql.ts @@ -298,31 +298,6 @@ export async function getCodeQLSource( }; } - /** - * Whether the tools shipped with the Action, i.e. those in `defaults.json`, have been forced. - * - * We use the special value of 'linked' to prioritize the version in `defaults.json` over the - * version specified by the feature flags on Dotcom and over any pinned cached version on - * Enterprise Server. - * - * Previously we have been using 'latest' to force the shipped tools, but this was not clear - * enough for the users, so it has been changed to `linked`. We're keeping around `latest` for - * backwards compatibility. - */ - const forceShippedTools = - toolsInput && CODEQL_BUNDLE_VERSION_ALIAS.includes(toolsInput); - if (forceShippedTools) { - logger.info( - `'tools: ${toolsInput}' was requested, so using CodeQL version ${defaultCliVersion.cliVersion}, the version shipped with the Action.`, - ); - - if (toolsInput === "latest") { - logger.warning( - "`tools: latest` has been renamed to `tools: linked`, but the old name is still supported. No action is required.", - ); - } - } - /** CLI version number, for example 2.12.6. */ let cliVersion: string | undefined; /** Tag name of the CodeQL bundle, for example `codeql-bundle-20230120`. */ @@ -344,9 +319,33 @@ export async function getCodeQLSource( toolsInput = await getNightlyToolsUrl(logger); } + /** + * Whether the tools shipped with the Action, i.e. those in `defaults.json`, have been forced. + * + * We use the special value of 'linked' to prioritize the version in `defaults.json` over the + * version specified by the feature flags on Dotcom and over any pinned cached version on + * Enterprise Server. + * + * Previously we have been using 'latest' to force the shipped tools, but this was not clear + * enough for the users, so it has been changed to `linked`. We're keeping around `latest` for + * backwards compatibility. + */ + const forceShippedTools = + toolsInput && CODEQL_BUNDLE_VERSION_ALIAS.includes(toolsInput); + if (forceShippedTools) { cliVersion = defaults.cliVersion; tagName = defaults.bundleVersion; + + logger.info( + `'tools: ${toolsInput}' was requested, so using CodeQL version ${cliVersion}, the version shipped with the Action.`, + ); + + if (toolsInput === "latest") { + logger.warning( + "`tools: latest` has been renamed to `tools: linked`, but the old name is still supported. No action is required.", + ); + } } else if (toolsInput !== undefined) { // If a tools URL was provided, then use that. tagName = tryGetTagNameFromUrl(toolsInput, logger);