Skip to content

Commit

Permalink
Use isFirstPartyAnalysis for a stronger check
Browse files Browse the repository at this point in the history
  • Loading branch information
henrymercer committed Feb 29, 2024
1 parent 888ab31 commit e12a8cc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
10 changes: 6 additions & 4 deletions lib/upload-sarif-action.js

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

2 changes: 1 addition & 1 deletion lib/upload-sarif-action.js.map

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

11 changes: 7 additions & 4 deletions src/upload-sarif-action.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as core from "@actions/core";

import * as actionsUtil from "./actions-util";
import { getActionVersion } from "./actions-util";
import { getActionVersion, isFirstPartyAnalysis } from "./actions-util";
import { getGitHubVersion } from "./api-client";
import { Logger, getActionsLogger } from "./logging";
import { parseRepositoryNwo } from "./repository";
Expand All @@ -22,6 +22,8 @@ import {
wrapError,
} from "./util";

const ACTION_NAME = "upload-sarif";

interface UploadSarifStatusReport
extends StatusReportBase,
upload_lib.UploadStatusReport {}
Expand All @@ -32,7 +34,7 @@ async function sendSuccessStatusReport(
logger: Logger,
) {
const statusReportBase = await createStatusReportBase(
"upload-sarif",
ACTION_NAME,
"success",
startedAt,
undefined,
Expand All @@ -56,7 +58,7 @@ async function run() {

await sendStatusReport(
await createStatusReportBase(
"upload-sarif",
ACTION_NAME,
"starting",
startedAt,
undefined,
Expand Down Expand Up @@ -87,6 +89,7 @@ async function run() {
await sendSuccessStatusReport(startedAt, uploadResult.statusReport, logger);
} catch (unwrappedError) {
const error =
!isFirstPartyAnalysis(ACTION_NAME) &&
unwrappedError instanceof upload_lib.InvalidSarifUploadError
? new ConfigurationError(unwrappedError.message)
: wrapError(unwrappedError);
Expand All @@ -95,7 +98,7 @@ async function run() {
console.log(error);
await sendStatusReport(
await createStatusReportBase(
"upload-sarif",
ACTION_NAME,
getActionsStatus(error),
startedAt,
undefined,
Expand Down

0 comments on commit e12a8cc

Please sign in to comment.