Skip to content

Commit e12a8cc

Browse files
committed
Use isFirstPartyAnalysis for a stronger check
1 parent 888ab31 commit e12a8cc

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

lib/upload-sarif-action.js

+6-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/upload-sarif-action.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/upload-sarif-action.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as core from "@actions/core";
22

33
import * as actionsUtil from "./actions-util";
4-
import { getActionVersion } from "./actions-util";
4+
import { getActionVersion, isFirstPartyAnalysis } from "./actions-util";
55
import { getGitHubVersion } from "./api-client";
66
import { Logger, getActionsLogger } from "./logging";
77
import { parseRepositoryNwo } from "./repository";
@@ -22,6 +22,8 @@ import {
2222
wrapError,
2323
} from "./util";
2424

25+
const ACTION_NAME = "upload-sarif";
26+
2527
interface UploadSarifStatusReport
2628
extends StatusReportBase,
2729
upload_lib.UploadStatusReport {}
@@ -32,7 +34,7 @@ async function sendSuccessStatusReport(
3234
logger: Logger,
3335
) {
3436
const statusReportBase = await createStatusReportBase(
35-
"upload-sarif",
37+
ACTION_NAME,
3638
"success",
3739
startedAt,
3840
undefined,
@@ -56,7 +58,7 @@ async function run() {
5658

5759
await sendStatusReport(
5860
await createStatusReportBase(
59-
"upload-sarif",
61+
ACTION_NAME,
6062
"starting",
6163
startedAt,
6264
undefined,
@@ -87,6 +89,7 @@ async function run() {
8789
await sendSuccessStatusReport(startedAt, uploadResult.statusReport, logger);
8890
} catch (unwrappedError) {
8991
const error =
92+
!isFirstPartyAnalysis(ACTION_NAME) &&
9093
unwrappedError instanceof upload_lib.InvalidSarifUploadError
9194
? new ConfigurationError(unwrappedError.message)
9295
: wrapError(unwrappedError);
@@ -95,7 +98,7 @@ async function run() {
9598
console.log(error);
9699
await sendStatusReport(
97100
await createStatusReportBase(
98-
"upload-sarif",
101+
ACTION_NAME,
99102
getActionsStatus(error),
100103
startedAt,
101104
undefined,

0 commit comments

Comments
 (0)