Remove checkActionVersion
This is no longer needed now that we only release v2
This commit is contained in:
parent
cb9be70046
commit
1b508953b4
18 changed files with 7 additions and 157 deletions
|
|
@ -181,7 +181,6 @@ async function run() {
|
|||
let dbCreationTimings: DatabaseCreationTimings | undefined = undefined;
|
||||
let didUploadTrapCaches = false;
|
||||
util.initializeEnvironment(pkg.version as string);
|
||||
await util.checkActionVersion(pkg.version as string);
|
||||
|
||||
const logger = getActionsLogger();
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import { Language } from "./languages";
|
|||
import { getActionsLogger } from "./logging";
|
||||
import {
|
||||
DID_AUTOBUILD_GO_ENV_VAR_NAME,
|
||||
checkActionVersion,
|
||||
checkGitHubVersionInRange,
|
||||
initializeEnvironment,
|
||||
} from "./util";
|
||||
|
|
@ -57,7 +56,6 @@ async function sendCompletedStatusReport(
|
|||
async function run() {
|
||||
const startedAt = new Date();
|
||||
const logger = getActionsLogger();
|
||||
await checkActionVersion(pkg.version as string);
|
||||
let currentLanguage: Language | undefined = undefined;
|
||||
let languages: Language[] | undefined = undefined;
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import { getActionsLogger, Logger } from "./logging";
|
|||
import { parseRepositoryNwo } from "./repository";
|
||||
import { getTotalCacheSize } from "./trap-caching";
|
||||
import {
|
||||
checkActionVersion,
|
||||
checkForTimeout,
|
||||
checkGitHubVersionInRange,
|
||||
codeQlVersionAbove,
|
||||
|
|
@ -139,7 +138,6 @@ async function run() {
|
|||
const startedAt = new Date();
|
||||
const logger = getActionsLogger();
|
||||
initializeEnvironment(pkg.version as string);
|
||||
await checkActionVersion(pkg.version as string);
|
||||
|
||||
let config: configUtils.Config;
|
||||
let codeql: CodeQL;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import { getActionsLogger } from "./logging";
|
|||
import { parseRepositoryNwo } from "./repository";
|
||||
import * as upload_lib from "./upload-lib";
|
||||
import {
|
||||
checkActionVersion,
|
||||
getRequiredEnvParam,
|
||||
initializeEnvironment,
|
||||
isInTestMode,
|
||||
|
|
@ -37,7 +36,6 @@ async function sendSuccessStatusReport(
|
|||
async function run() {
|
||||
const startedAt = new Date();
|
||||
initializeEnvironment(pkg.version as string);
|
||||
await checkActionVersion(pkg.version as string);
|
||||
if (
|
||||
!(await actionsUtil.sendStatusReport(
|
||||
await actionsUtil.createStatusReportBase(
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import * as fs from "fs";
|
|||
import * as os from "os";
|
||||
import path from "path";
|
||||
|
||||
import * as core from "@actions/core";
|
||||
import * as github from "@actions/github";
|
||||
import test from "ava";
|
||||
import * as sinon from "sinon";
|
||||
|
|
@ -312,65 +311,6 @@ for (const [packs, expectedStatus] of ML_POWERED_JS_STATUS_TESTS) {
|
|||
});
|
||||
}
|
||||
|
||||
function formatGitHubVersion(version: util.GitHubVersion): string {
|
||||
switch (version.type) {
|
||||
case util.GitHubVariant.DOTCOM:
|
||||
return "dotcom";
|
||||
case util.GitHubVariant.GHAE:
|
||||
return "GHAE";
|
||||
case util.GitHubVariant.GHES:
|
||||
return `GHES ${version.version}`;
|
||||
default:
|
||||
util.assertNever(version);
|
||||
}
|
||||
}
|
||||
|
||||
const CHECK_ACTION_VERSION_TESTS: Array<[string, util.GitHubVersion, boolean]> =
|
||||
[
|
||||
["1.2.1", { type: util.GitHubVariant.DOTCOM }, true],
|
||||
["1.2.1", { type: util.GitHubVariant.GHAE }, true],
|
||||
["1.2.1", { type: util.GitHubVariant.GHES, version: "3.3" }, true],
|
||||
["1.2.1", { type: util.GitHubVariant.GHES, version: "3.4" }, true],
|
||||
["1.2.1", { type: util.GitHubVariant.GHES, version: "3.5" }, true],
|
||||
["2.2.1", { type: util.GitHubVariant.DOTCOM }, false],
|
||||
["2.2.1", { type: util.GitHubVariant.GHAE }, false],
|
||||
["2.2.1", { type: util.GitHubVariant.GHES, version: "3.3" }, false],
|
||||
["2.2.1", { type: util.GitHubVariant.GHES, version: "3.4" }, false],
|
||||
["2.2.1", { type: util.GitHubVariant.GHES, version: "3.5" }, false],
|
||||
];
|
||||
|
||||
for (const [
|
||||
version,
|
||||
githubVersion,
|
||||
shouldReportError,
|
||||
] of CHECK_ACTION_VERSION_TESTS) {
|
||||
const reportErrorDescription = shouldReportError
|
||||
? "reports error"
|
||||
: "doesn't report error";
|
||||
const versionsDescription = `CodeQL Action version ${version} and GitHub version ${formatGitHubVersion(
|
||||
githubVersion
|
||||
)}`;
|
||||
test(`checkActionVersion ${reportErrorDescription} for ${versionsDescription}`, async (t) => {
|
||||
const errorSpy = sinon.spy(core, "error");
|
||||
const versionStub = sinon
|
||||
.stub(api, "getGitHubVersion")
|
||||
.resolves(githubVersion);
|
||||
await util.checkActionVersion(version);
|
||||
if (shouldReportError) {
|
||||
t.true(
|
||||
errorSpy.calledOnceWithExactly(
|
||||
sinon.match(
|
||||
"This version of the CodeQL Action was deprecated on January 18th, 2023"
|
||||
)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
t.false(errorSpy.called);
|
||||
}
|
||||
versionStub.restore();
|
||||
});
|
||||
}
|
||||
|
||||
test("doesDirectoryExist", async (t) => {
|
||||
// Returns false if no file/dir of this name exists
|
||||
t.false(util.doesDirectoryExist("non-existent-file.txt"));
|
||||
|
|
|
|||
18
src/util.ts
18
src/util.ts
|
|
@ -628,24 +628,6 @@ export function getMlPoweredJsQueriesStatus(config: Config): string {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prompt the customer to upgrade to CodeQL Action v2, if appropriate.
|
||||
*
|
||||
* Check whether a customer is running v1. If they are, and we can determine that the GitHub
|
||||
* instance supports v2, then log an error that v1 is deprecated and prompt the customer to
|
||||
* upgrade to v2.
|
||||
*/
|
||||
export async function checkActionVersion(version: string) {
|
||||
if (!semver.satisfies(version, ">=2")) {
|
||||
core.error(
|
||||
"This version of the CodeQL Action was deprecated on January 18th, 2023, and is no longer " +
|
||||
"updated or supported. For better performance, improved security, and new features, " +
|
||||
"upgrade to v2. For more information, see " +
|
||||
"https://github.blog/changelog/2023-01-18-code-scanning-codeql-action-v1-is-now-deprecated/"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns whether we are in test mode.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue