Skip to content

Commit ca32b84

Browse files
committed
Ensure correct failed SARIF file names for CSRA
1 parent ce97dfe commit ca32b84

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

lib/init-action-post.js

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/init-action-post-helper.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import path from "path";
44
import * as github from "@actions/github";
55

66
import * as actionsUtil from "./actions-util";
7-
import { CodeScanning } from "./analyses";
7+
import { CodeScanning, RiskAssessment } from "./analyses";
88
import { getApiClient, getGitHubVersion } from "./api-client";
99
import { CodeQL, getCodeQL } from "./codeql";
1010
import {
@@ -115,13 +115,15 @@ async function prepareFailedSarif(
115115
}
116116

117117
// We can make these assumptions for risk assessments.
118-
const category = `/language:${config.languages[0]}`;
118+
const language = config.languages[0];
119+
const category = `/language:${language}`;
119120
const checkoutPath = ".";
120121
const result = await generateFailedSarif(
121122
features,
122123
config,
123124
category,
124125
checkoutPath,
126+
`../codeql-failed-sarif-${language}${RiskAssessment.sarifExtension}`,
125127
);
126128
return new Success(result);
127129
} else {
@@ -154,11 +156,15 @@ async function generateFailedSarif(
154156
config: Config,
155157
category: string | undefined,
156158
checkoutPath: string,
159+
sarifFile?: string,
157160
) {
158161
const databasePath = config.dbLocation;
159-
160162
const codeql = await getCodeQL(config.codeQLCmd);
161-
const sarifFile = "../codeql-failed-run.sarif";
163+
164+
// Set the filename for the SARIF file if not already set.
165+
if (sarifFile === undefined) {
166+
sarifFile = "../codeql-failed-run.sarif";
167+
}
162168

163169
// If there is no database or the feature flag is off, we run 'export diagnostics'
164170
if (

0 commit comments

Comments
 (0)