Fix getSarifFilePaths not using right filter

This commit is contained in:
Michael B. Gale 2025-06-17 15:06:55 +01:00
parent f1834221f2
commit 6abacdb184
No known key found for this signature in database
GPG key ID: FF5E2765BD00628F
3 changed files with 13 additions and 7 deletions

6
lib/upload-lib.js generated
View file

@ -300,14 +300,14 @@ function findSarifFilesInDir(sarifPath, isSarif = defaultIsSarif) {
walkSarifFiles(sarifPath);
return sarifFiles;
}
function getSarifFilePaths(sarifPath) {
function getSarifFilePaths(sarifPath, isSarif = defaultIsSarif) {
if (!fs.existsSync(sarifPath)) {
// This is always a configuration error, even for first-party runs.
throw new util_1.ConfigurationError(`Path does not exist: ${sarifPath}`);
}
let sarifFiles;
if (fs.lstatSync(sarifPath).isDirectory()) {
sarifFiles = findSarifFilesInDir(sarifPath);
sarifFiles = findSarifFilesInDir(sarifPath, isSarif);
if (sarifFiles.length === 0) {
// This is always a configuration error, even for first-party runs.
throw new util_1.ConfigurationError(`No SARIF files found to upload in "${sarifPath}".`);
@ -434,7 +434,7 @@ exports.CodeQualityTarget = {
* to.
*/
async function uploadFiles(inputSarifPath, checkoutPath, category, features, logger, uploadTarget = exports.CodeScanningTarget) {
const sarifPaths = getSarifFilePaths(inputSarifPath);
const sarifPaths = getSarifFilePaths(inputSarifPath, uploadTarget.sarifFilter);
logger.startGroup(`Uploading ${uploadTarget.name} results`);
logger.info(`Processing sarif files: ${JSON.stringify(sarifPaths)}`);
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();

File diff suppressed because one or more lines are too long