@@ -4,7 +4,7 @@ import path from "path";
44import * as github from "@actions/github" ;
55
66import * as actionsUtil from "./actions-util" ;
7- import { CodeScanning } from "./analyses" ;
7+ import { CodeScanning , RiskAssessment } from "./analyses" ;
88import { getApiClient , getGitHubVersion } from "./api-client" ;
99import { CodeQL , getCodeQL } from "./codeql" ;
1010import {
@@ -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