mirror of
https://github.com/github/codeql-action.git
synced 2026-04-26 16:58:47 +00:00
Clean up pre GHES 3.14 code paths
This commit is contained in:
@@ -356,7 +356,6 @@ export async function createStatusReportBase(
|
||||
statusReport.matrix_vars = matrix;
|
||||
}
|
||||
if ("RUNNER_ARCH" in process.env) {
|
||||
// RUNNER_ARCH is available only in GHES 3.4 and later
|
||||
// Values other than X86, X64, ARM, or ARM64 are discarded server side
|
||||
statusReport.runner_arch = process.env["RUNNER_ARCH"];
|
||||
}
|
||||
|
||||
+19
-87
@@ -631,57 +631,10 @@ test.serial(
|
||||
"shouldShowCombineSarifFilesDeprecationWarning when on dotcom",
|
||||
async (t) => {
|
||||
t.true(
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
|
||||
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
|
||||
{
|
||||
type: GitHubVariant.DOTCOM,
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
test.serial(
|
||||
"shouldShowCombineSarifFilesDeprecationWarning when on GHES 3.13",
|
||||
async (t) => {
|
||||
t.false(
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
|
||||
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
|
||||
{
|
||||
type: GitHubVariant.GHES,
|
||||
version: "3.13.2",
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
test.serial(
|
||||
"shouldShowCombineSarifFilesDeprecationWarning when on GHES 3.14",
|
||||
async (t) => {
|
||||
t.true(
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
|
||||
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
|
||||
{
|
||||
type: GitHubVariant.GHES,
|
||||
version: "3.14.0",
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
test.serial(
|
||||
"shouldShowCombineSarifFilesDeprecationWarning when on GHES 3.16 pre",
|
||||
async (t) => {
|
||||
t.true(
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
|
||||
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
|
||||
{
|
||||
type: GitHubVariant.GHES,
|
||||
version: "3.16.0.pre1",
|
||||
},
|
||||
),
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning([
|
||||
createMockSarif("abc", "def"),
|
||||
createMockSarif("abc", "def"),
|
||||
]),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -690,12 +643,9 @@ test.serial(
|
||||
"shouldShowCombineSarifFilesDeprecationWarning with only 1 run",
|
||||
async (t) => {
|
||||
t.false(
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
|
||||
[createMockSarif("abc", "def")],
|
||||
{
|
||||
type: GitHubVariant.DOTCOM,
|
||||
},
|
||||
),
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning([
|
||||
createMockSarif("abc", "def"),
|
||||
]),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -704,12 +654,10 @@ test.serial(
|
||||
"shouldShowCombineSarifFilesDeprecationWarning with distinct categories",
|
||||
async (t) => {
|
||||
t.false(
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
|
||||
[createMockSarif("abc", "def"), createMockSarif("def", "def")],
|
||||
{
|
||||
type: GitHubVariant.DOTCOM,
|
||||
},
|
||||
),
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning([
|
||||
createMockSarif("abc", "def"),
|
||||
createMockSarif("def", "def"),
|
||||
]),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -718,12 +666,10 @@ test.serial(
|
||||
"shouldShowCombineSarifFilesDeprecationWarning with distinct tools",
|
||||
async (t) => {
|
||||
t.false(
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
|
||||
[createMockSarif("abc", "abc"), createMockSarif("abc", "def")],
|
||||
{
|
||||
type: GitHubVariant.DOTCOM,
|
||||
},
|
||||
),
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning([
|
||||
createMockSarif("abc", "abc"),
|
||||
createMockSarif("abc", "def"),
|
||||
]),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -734,12 +680,10 @@ test.serial(
|
||||
process.env["CODEQL_MERGE_SARIF_DEPRECATION_WARNING"] = "true";
|
||||
|
||||
t.false(
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning(
|
||||
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
|
||||
{
|
||||
type: GitHubVariant.DOTCOM,
|
||||
},
|
||||
),
|
||||
await uploadLib.shouldShowCombineSarifFilesDeprecationWarning([
|
||||
createMockSarif("abc", "def"),
|
||||
createMockSarif("abc", "def"),
|
||||
]),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -759,18 +703,6 @@ test.serial("throwIfCombineSarifFilesDisabled when on dotcom", async (t) => {
|
||||
);
|
||||
});
|
||||
|
||||
test.serial("throwIfCombineSarifFilesDisabled when on GHES 3.13", async (t) => {
|
||||
await t.notThrowsAsync(
|
||||
uploadLib.throwIfCombineSarifFilesDisabled(
|
||||
[createMockSarif("abc", "def"), createMockSarif("abc", "def")],
|
||||
{
|
||||
type: GitHubVariant.GHES,
|
||||
version: "3.13.2",
|
||||
},
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
test.serial("throwIfCombineSarifFilesDisabled when on GHES 3.14", async (t) => {
|
||||
await t.notThrowsAsync(
|
||||
uploadLib.throwIfCombineSarifFilesDisabled(
|
||||
|
||||
+1
-15
@@ -47,16 +47,7 @@ const GENERIC_404_MSG =
|
||||
// Checks whether the deprecation warning for combining SARIF files should be shown.
|
||||
export async function shouldShowCombineSarifFilesDeprecationWarning(
|
||||
sarifObjects: Array<Partial<sarif.Log>>,
|
||||
githubVersion: GitHubVersion,
|
||||
) {
|
||||
// Do not show this warning on GHES versions before 3.14.0
|
||||
if (
|
||||
githubVersion.type === GitHubVariant.GHES &&
|
||||
satisfiesGHESVersion(githubVersion.version, "<3.14", true)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only give a deprecation warning when not all runs are unique and
|
||||
// we haven't already shown the warning.
|
||||
return (
|
||||
@@ -131,12 +122,7 @@ async function combineSarifFilesUsingCLI(
|
||||
"Not all SARIF files were produced by CodeQL. Merging files in the action.",
|
||||
);
|
||||
|
||||
if (
|
||||
await shouldShowCombineSarifFilesDeprecationWarning(
|
||||
sarifObjects,
|
||||
gitHubVersion,
|
||||
)
|
||||
) {
|
||||
if (await shouldShowCombineSarifFilesDeprecationWarning(sarifObjects)) {
|
||||
logger.warning(
|
||||
`Uploading multiple SARIF runs with the same category is deprecated ${deprecationWarningMessage}. Please update your workflow to upload a single run per category. ${deprecationMoreInformationMessage}`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user