Add deprecation warning for CodeQL CLIs < 2.9.4

This commit is contained in:
Henry Mercer
2023-07-06 11:56:49 +01:00
parent a2d725ddd0
commit 485b5809e8
3 changed files with 41 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
import * as fs from "fs";
import * as path from "path";
import * as core from "@actions/core";
import * as toolrunner from "@actions/exec/lib/toolrunner";
import * as yaml from "js-yaml";
@@ -270,6 +271,11 @@ let cachedCodeQL: CodeQL | undefined = undefined;
*/
const CODEQL_MINIMUM_VERSION = "2.8.5";
/**
* This version will shortly become the oldest version of CodeQL that the Action will run with.
*/
const CODEQL_NEXT_MINIMUM_VERSION = "2.9.4";
/**
* Versions of CodeQL that version-flag certain functionality in the Action.
* For convenience, please keep these in descending order. Once a version
@@ -1032,6 +1038,22 @@ export async function getCodeQLForCmd(
throw new Error(
`Expected a CodeQL CLI with version at least ${CODEQL_MINIMUM_VERSION} but got version ${await codeql.getVersion()}`
);
} else if (
checkVersion &&
!(await util.codeQlVersionAbove(codeql, CODEQL_NEXT_MINIMUM_VERSION))
) {
core.warning(
`CodeQL CLI version ${await codeql.getVersion()} was deprecated on 2023-06-20 alongside ` +
"GitHub Enterprise Server 3.5 and will not be supported by the next release of the " +
"CodeQL Action. Please update to a newer version of the CodeQL CLI " +
`(minimum ${CODEQL_NEXT_MINIMUM_VERSION}). For instance, if you have specified a custom ` +
"version of the CLI using the 'tools' input to the 'init' Action, you can remove it to " +
"use the default version.\n\n" +
"Alternatively, if you want to continue using CodeQL CLI version " +
`${await codeql.getVersion()}, you can replace 'github/codeql-action/*@v2' by ` +
"'github/codeql-action/*@v2.20.4' in your code scanning workflow to ensure you continue " +
"using this version of the CodeQL Action."
);
}
return codeql;
}