Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions lib/analyze-action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions lib/init-action-post.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions lib/upload-lib.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions lib/upload-sarif-action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/status-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
}
Expand Down
106 changes: 19 additions & 87 deletions src/upload-lib.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
]),
);
},
);
Expand All @@ -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"),
]),
);
},
);
Expand All @@ -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"),
]),
);
},
);
Expand All @@ -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"),
]),
);
},
);
Expand All @@ -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"),
]),
);
},
);
Expand All @@ -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(
Expand Down
16 changes: 1 addition & 15 deletions src/upload-lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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}`,
);
Expand Down
Loading