Skip to content

Commit 90b6d6b

Browse files
committed
feat: add sarif-tool-name input to configure SARIF file tool name rewriting
1 parent 5b2a16e commit 90b6d6b

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ inputs:
2525
default: latest
2626
working-directory:
2727
description: Working Directory
28+
sarif-tool-name:
29+
description: Re-write SARIF file tool name
30+
default: 'true'
2831
attestation:
2932
description: Attestation
3033
default: 'false'

src/action.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ pub struct Action {
8585
)]
8686
working_directory: String,
8787

88+
/// Re-write SARIF file tool name
89+
#[input(
90+
description = "Re-write SARIF file tool name",
91+
rename = "sarif-tool-name",
92+
default = "true"
93+
)]
94+
sarif_tool_name: bool,
95+
8896
/// Attestation
8997
#[input(description = "Attestation", default = "false")]
9098
attestation: bool,
@@ -360,6 +368,11 @@ impl Action {
360368
log::debug!("Allow empty database: {}", self.allow_empty_database);
361369
self.allow_empty_database
362370
}
371+
372+
pub fn sarif_tool_name(&self) -> bool {
373+
log::debug!("Re-write SARIF tool name: {}", self.sarif_tool_name);
374+
self.sarif_tool_name
375+
}
363376
}
364377

365378
#[cfg(test)]

src/main.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,13 @@ async fn main() -> Result<()> {
269269

270270
log::info!("Post-processing SARIF results");
271271

272-
extractors::update_sarif(&sarif_path, extractor.display_name.clone())
273-
.context("Failed to update SARIF file with extractor information")?;
272+
if action.sarif_tool_name() {
273+
log::info!("Updating SARIF tool name with extractor information");
274+
extractors::update_sarif(&sarif_path, extractor.display_name.clone())
275+
.context("Failed to update SARIF file with extractor information")?;
276+
} else {
277+
log::info!("Skipping SARIF tool name update as per configuration");
278+
}
274279

275280
// Reload the database to get analysis info
276281
database.reload()?;

0 commit comments

Comments
 (0)