Do not try merging a single SARIF file
This commit is contained in:
parent
3bd271cec3
commit
a0a63a2dd4
3 changed files with 8 additions and 1 deletions
3
lib/upload-lib.js
generated
3
lib/upload-lib.js
generated
|
|
@ -88,6 +88,9 @@ function areAllRunsProducedByCodeQL(sarifFiles) {
|
||||||
// CodeQL. Otherwise, it will fall back to combining the files in the action.
|
// CodeQL. Otherwise, it will fall back to combining the files in the action.
|
||||||
// Returns the contents of the combined sarif file.
|
// Returns the contents of the combined sarif file.
|
||||||
async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, logger) {
|
async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, logger) {
|
||||||
|
if (sarifFiles.length === 1) {
|
||||||
|
return JSON.parse(fs.readFileSync(sarifFiles[0], "utf8"));
|
||||||
|
}
|
||||||
if (!areAllRunsProducedByCodeQL(sarifFiles)) {
|
if (!areAllRunsProducedByCodeQL(sarifFiles)) {
|
||||||
logger.warning("Not all SARIF files were produced by CodeQL. Merging files in the action.");
|
logger.warning("Not all SARIF files were produced by CodeQL. Merging files in the action.");
|
||||||
// If not, use the naive method of combining the files.
|
// If not, use the naive method of combining the files.
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -93,6 +93,10 @@ async function combineSarifFilesUsingCLI(
|
||||||
features: Features,
|
features: Features,
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
): Promise<SarifFile> {
|
): Promise<SarifFile> {
|
||||||
|
if (sarifFiles.length === 1) {
|
||||||
|
return JSON.parse(fs.readFileSync(sarifFiles[0], "utf8")) as SarifFile;
|
||||||
|
}
|
||||||
|
|
||||||
if (!areAllRunsProducedByCodeQL(sarifFiles)) {
|
if (!areAllRunsProducedByCodeQL(sarifFiles)) {
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Not all SARIF files were produced by CodeQL. Merging files in the action.",
|
"Not all SARIF files were produced by CodeQL. Merging files in the action.",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue