Clean up pre GHES 3.14 code paths

This commit is contained in:
Henry Mercer
2026-03-09 16:35:21 +00:00
parent b39251fe78
commit ab180c9eeb
7 changed files with 28 additions and 135 deletions

10
lib/analyze-action.js generated
View File

@@ -112465,10 +112465,7 @@ function areAllRunsUnique(sarifLogs) {
// src/upload-lib.ts
var GENERIC_403_MSG = "The repo on which this action is running has not opted-in to CodeQL code scanning.";
var GENERIC_404_MSG = "The CodeQL code scanning feature is forbidden on this repository.";
async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, githubVersion) {
if (githubVersion.type === "GitHub Enterprise Server" /* GHES */ && satisfiesGHESVersion(githubVersion.version, "<3.14", true)) {
return false;
}
async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects) {
return !areAllRunsUnique(sarifObjects) && !process.env.CODEQL_MERGE_SARIF_DEPRECATION_WARNING;
}
async function throwIfCombineSarifFilesDisabled(sarifObjects, githubVersion) {
@@ -112501,10 +112498,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
logger.debug(
"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}`
);

View File

@@ -169555,10 +169555,7 @@ function areAllRunsUnique(sarifLogs) {
// src/upload-lib.ts
var GENERIC_403_MSG = "The repo on which this action is running has not opted-in to CodeQL code scanning.";
var GENERIC_404_MSG = "The CodeQL code scanning feature is forbidden on this repository.";
async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, githubVersion) {
if (githubVersion.type === "GitHub Enterprise Server" /* GHES */ && satisfiesGHESVersion(githubVersion.version, "<3.14", true)) {
return false;
}
async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects) {
return !areAllRunsUnique(sarifObjects) && !process.env.CODEQL_MERGE_SARIF_DEPRECATION_WARNING;
}
async function throwIfCombineSarifFilesDisabled(sarifObjects, githubVersion) {
@@ -169591,10 +169588,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
logger.debug(
"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}`
);

10
lib/upload-lib.js generated
View File

@@ -110352,10 +110352,7 @@ function areAllRunsUnique(sarifLogs) {
// src/upload-lib.ts
var GENERIC_403_MSG = "The repo on which this action is running has not opted-in to CodeQL code scanning.";
var GENERIC_404_MSG = "The CodeQL code scanning feature is forbidden on this repository.";
async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, githubVersion) {
if (githubVersion.type === "GitHub Enterprise Server" /* GHES */ && satisfiesGHESVersion(githubVersion.version, "<3.14", true)) {
return false;
}
async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects) {
return !areAllRunsUnique(sarifObjects) && !process.env.CODEQL_MERGE_SARIF_DEPRECATION_WARNING;
}
async function throwIfCombineSarifFilesDisabled(sarifObjects, githubVersion) {
@@ -110388,10 +110385,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
logger.debug(
"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}`
);

View File

@@ -110944,10 +110944,7 @@ async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVe
// src/upload-lib.ts
var GENERIC_403_MSG = "The repo on which this action is running has not opted-in to CodeQL code scanning.";
var GENERIC_404_MSG = "The CodeQL code scanning feature is forbidden on this repository.";
async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects, githubVersion) {
if (githubVersion.type === "GitHub Enterprise Server" /* GHES */ && satisfiesGHESVersion(githubVersion.version, "<3.14", true)) {
return false;
}
async function shouldShowCombineSarifFilesDeprecationWarning(sarifObjects) {
return !areAllRunsUnique(sarifObjects) && !process.env.CODEQL_MERGE_SARIF_DEPRECATION_WARNING;
}
async function throwIfCombineSarifFilesDisabled(sarifObjects, githubVersion) {
@@ -110980,10 +110977,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
logger.debug(
"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}`
);

View File

@@ -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"];
}

View File

@@ -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(

View File

@@ -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}`,
);