ensure only the upload-sarif action can submit a status report with first_party_analysis=false

This commit is contained in:
nickfyson 2024-02-21 14:01:56 +00:00
parent a7dc229496
commit f32f0bf8e4
9 changed files with 77 additions and 23 deletions

View file

@ -79,7 +79,7 @@ test("createStatusReportBase_firstParty", async (t) => {
t.is(
(
await createStatusReportBase(
"init",
"upload-sarif",
"failure",
new Date("May 19, 2023 05:19:00"),
{ numAvailableBytes: 100, numTotalBytes: 500 },
@ -90,11 +90,25 @@ test("createStatusReportBase_firstParty", async (t) => {
false,
);
t.is(
(
await createStatusReportBase(
"autobuild",
"failure",
new Date("May 19, 2023 05:19:00"),
{ numAvailableBytes: 100, numTotalBytes: 500 },
"failure cause",
"exception stack trace",
)
).first_party_analysis,
true,
);
process.env["CODEQL_INIT_ACTION_HAS_RUN"] = "foobar";
t.is(
(
await createStatusReportBase(
"init",
"upload-sarif",
"failure",
new Date("May 19, 2023 05:19:00"),
{ numAvailableBytes: 100, numTotalBytes: 500 },
@ -105,7 +119,6 @@ test("createStatusReportBase_firstParty", async (t) => {
false,
);
process.env["CODEQL_INIT_ACTION_HAS_RUN"] = "true";
t.is(
(
await createStatusReportBase(
@ -119,5 +132,34 @@ test("createStatusReportBase_firstParty", async (t) => {
).first_party_analysis,
true,
);
process.env["CODEQL_INIT_ACTION_HAS_RUN"] = "true";
t.is(
(
await createStatusReportBase(
"upload-sarif",
"failure",
new Date("May 19, 2023 05:19:00"),
{ numAvailableBytes: 100, numTotalBytes: 500 },
"failure cause",
"exception stack trace",
)
).first_party_analysis,
true,
);
t.is(
(
await createStatusReportBase(
"finish",
"failure",
new Date("May 19, 2023 05:19:00"),
{ numAvailableBytes: 100, numTotalBytes: 500 },
"failure cause",
"exception stack trace",
)
).first_party_analysis,
true,
);
});
});