mirror of
https://github.com/github/codeql-action.git
synced 2026-10-31 01:49:43 +00:00
Move formatGitHubVersion into util.test.ts
This commit is contained in:
@@ -394,6 +394,19 @@ test("isGitHubGhesVersionBelow", async (t) => {
|
||||
);
|
||||
});
|
||||
|
||||
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],
|
||||
@@ -416,7 +429,7 @@ for (const [
|
||||
const reportWarningDescription = shouldReportWarning
|
||||
? "reports warning"
|
||||
: "doesn't report warning";
|
||||
const versionsDescription = `CodeQL Action version ${version} and GitHub version ${util.formatGitHubVersion(
|
||||
const versionsDescription = `CodeQL Action version ${version} and GitHub version ${formatGitHubVersion(
|
||||
githubVersion
|
||||
)}`;
|
||||
test(`checkActionVersion ${reportWarningDescription} for ${versionsDescription}`, async (t) => {
|
||||
|
||||
13
src/util.ts
13
src/util.ts
@@ -738,16 +738,3 @@ export async function checkActionVersion(version: string) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function formatGitHubVersion(version: GitHubVersion): string {
|
||||
switch (version.type) {
|
||||
case GitHubVariant.DOTCOM:
|
||||
return "dotcom";
|
||||
case GitHubVariant.GHAE:
|
||||
return "GHAE";
|
||||
case GitHubVariant.GHES:
|
||||
return `GHES ${version.version}`;
|
||||
default:
|
||||
assertNever(version);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user