Convert deprecation warning to error

This commit is contained in:
Angela P Wen 2025-01-07 13:59:42 -08:00
parent a06dbc607d
commit 04b5afaa72
9 changed files with 44 additions and 39 deletions

17
lib/util.js generated
View file

@ -848,15 +848,14 @@ async function checkDiskUsage(logger) {
/**
* Prompt the customer to upgrade to CodeQL Action v3, if appropriate.
*
* Check whether a customer is running v2. If they are, and we can determine that the GitHub
* instance supports v3, then log a warning about v2's upcoming deprecation prompting the customer
* to upgrade to v3.
* Check whether a customer is running v1 or v2. If they are, and we can determine that the GitHub
* instance supports v3, then log an error prompting the customer to upgrade to v3.
*/
function checkActionVersion(version, githubVersion) {
if (!semver.satisfies(version, ">=3") && // do not warn if the customer is already running v3
!process.env.CODEQL_V2_DEPRECATION_WARNING // do not warn if we have already warned
if (!semver.satisfies(version, ">=3") && // do not log error if the customer is already running v3
!process.env[environment_1.EnvVar.LOG_VERSION_DEPRECATION] // do not log error if we have already
) {
// Only log a warning for versions of GHES that are compatible with CodeQL Action version 3.
// Only error for versions of GHES that are compatible with CodeQL Action version 3.
//
// GHES 3.11 shipped without the v3 tag, but it also shipped without this warning message code.
// Therefore users who are seeing this warning message code have pulled in a new version of the
@ -865,12 +864,12 @@ function checkActionVersion(version, githubVersion) {
githubVersion.type === GitHubVariant.GHE_DOTCOM ||
(githubVersion.type === GitHubVariant.GHES &&
semver.satisfies(semver.coerce(githubVersion.version) ?? "0.0.0", ">=3.11"))) {
core.warning("CodeQL Action v2 will be deprecated on December 5th, 2024. " +
core.error("CodeQL Action major versions v1 and v2 have been deprecated. " +
"Please update all occurrences of the CodeQL Action in your workflow files to v3. " +
"For more information, see " +
"https://github.blog/changelog/2024-01-12-code-scanning-deprecation-of-codeql-action-v2/");
// set CODEQL_V2_DEPRECATION_WARNING env var to prevent the warning from being logged multiple times
core.exportVariable("CODEQL_V2_DEPRECATION_WARNING", "true");
// set LOG_VERSION_DEPRECATION env var to prevent the warning from being logged multiple times
core.exportVariable(environment_1.EnvVar.LOG_VERSION_DEPRECATION, "true");
}
}
}