diff --git a/CHANGELOG.md b/CHANGELOG.md index d2e5bd94af..6e2575a489 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ See the [releases page](https://github.com/github/codeql-action/releases) for th ## [UNRELEASED] -No user facing changes. +- We fixed a bug that was introduced in `3.30.4` with `upload-sarif` which resulted in files without a `.sarif` extension not getting uploaded. [#3160](https://github.com/github/codeql-action/pull/3160) ## 3.30.4 - 25 Sep 2025 diff --git a/lib/upload-sarif-action.js b/lib/upload-sarif-action.js index 341b173e0d..59c660b275 100644 --- a/lib/upload-sarif-action.js +++ b/lib/upload-sarif-action.js @@ -93424,7 +93424,7 @@ async function findAndUpload(logger, features, sarifPath, pathStats, checkoutPat sarifPath, analysis.sarifPredicate ); - } else if (pathStats.isFile() && analysis.sarifPredicate(sarifPath)) { + } else if (pathStats.isFile() && (analysis.sarifPredicate(sarifPath) || analysis.kind === "code-scanning" /* CodeScanning */ && !CodeQuality.sarifPredicate(sarifPath))) { sarifFiles = [sarifPath]; } else { return void 0; diff --git a/src/upload-sarif-action.ts b/src/upload-sarif-action.ts index aa1a5a4443..4da0427490 100644 --- a/src/upload-sarif-action.ts +++ b/src/upload-sarif-action.ts @@ -61,7 +61,12 @@ async function findAndUpload( sarifPath, analysis.sarifPredicate, ); - } else if (pathStats.isFile() && analysis.sarifPredicate(sarifPath)) { + } else if ( + pathStats.isFile() && + (analysis.sarifPredicate(sarifPath) || + (analysis.kind === analyses.AnalysisKind.CodeScanning && + !analyses.CodeQuality.sarifPredicate(sarifPath))) + ) { sarifFiles = [sarifPath]; } else { return undefined;