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
45
lib/util.test.js
generated
45
lib/util.test.js
generated
|
|
@ -29,7 +29,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
const fs = __importStar(require("fs"));
|
||||
const os = __importStar(require("os"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const github = __importStar(require("@actions/github"));
|
||||
const ava_1 = __importDefault(require("ava"));
|
||||
const sinon = __importStar(require("sinon"));
|
||||
|
|
@ -249,50 +248,6 @@ for (const [packs, expectedStatus] of ML_POWERED_JS_STATUS_TESTS) {
|
|||
});
|
||||
});
|
||||
}
|
||||
function formatGitHubVersion(version) {
|
||||
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 = [
|
||||
["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)}`;
|
||||
(0, ava_1.default)(`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();
|
||||
});
|
||||
}
|
||||
(0, ava_1.default)("doesDirectoryExist", async (t) => {
|
||||
// Returns false if no file/dir of this name exists
|
||||
t.false(util.doesDirectoryExist("non-existent-file.txt"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue