ensure deprecation warning is only shown once per job
This commit is contained in:
parent
f72cffc780
commit
a854253aca
6 changed files with 17 additions and 4 deletions
|
|
@ -433,6 +433,8 @@ for (const [
|
|||
.stub(api, "getGitHubVersion")
|
||||
.resolves(githubVersion);
|
||||
|
||||
// call checkActionVersion twice and assert below that warning is reported only once
|
||||
util.checkActionVersion(version, await api.getGitHubVersion());
|
||||
util.checkActionVersion(version, await api.getGitHubVersion());
|
||||
|
||||
if (shouldReportWarning) {
|
||||
|
|
|
|||
|
|
@ -956,7 +956,10 @@ export function checkActionVersion(
|
|||
version: string,
|
||||
githubVersion: GitHubVersion,
|
||||
) {
|
||||
if (!semver.satisfies(version, ">=3")) {
|
||||
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
|
||||
) {
|
||||
// Only log a warning 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.
|
||||
|
|
@ -976,6 +979,8 @@ export function checkActionVersion(
|
|||
"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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue