You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sarif_output creates an invalid file when there are no lintr results (i.e. all linting checks passed). This causes workflows that upload the file to GitHub to populate the Code scanning section of the Security tab to fail.
Example
See this GitHub Actions run file for an example of the error (under Upload analysis results to GitHub):
Run github/codeql-action/upload-sarif@v2
with:
sarif_file: lintr-results.sarif
wait-for-processing: true
checkout_path: /home/runner/work/usmap/usmap
token: ***
matrix: null
env:
R_LIBS_USER: /home/runner/work/_temp/Library
TZ: UTC
_R_CHECK_SYSTEM_CLOCK_: FALSE
NOT_CRAN: true
Uploading results
Processing sarif files: ["lintr-results.sarif"]
Error: Invalid SARIF. Missing 'results' array in run.
Error: Error: Invalid SARIF. Missing 'results' array in run.
at countResultsInSarif (/home/runner/work/_actions/github/codeql-action/v2/lib/upload-lib.js:166:19)
at uploadFiles (/home/runner/work/_actions/github/codeql-action/v2/lib/upload-lib.js:256:30)
at async Object.uploadFromActions (/home/runner/work/_actions/github/codeql-action/v2/lib/upload-lib.js:132:12)
at async run (/home/runner/work/_actions/github/codeql-action/v2/lib/upload-sarif-action.js:46:30)
at async runWrapper (/home/runner/work/_actions/github/codeql-action/v2/lib/upload-sarif-action.js:68:9)
The SARIF file for my project comes back as follows:
Include the results array inside each run in the SARIF file even if there are no issues returned by lintr. I believe it should work if it's an empty array in that case (i.e. "results": []).
Thanks for the report! Unfortunately I think none of the maintainers are particularly adept with SARIF, so a PR would be welcome! cc original PR author @shaopeng-gh
Issue
sarif_output
creates an invalid file when there are nolintr
results (i.e. all linting checks passed). This causes workflows that upload the file to GitHub to populate the Code scanning section of the Security tab to fail.Example
See this GitHub Actions run file for an example of the error (under
Upload analysis results to GitHub
):The SARIF file for my project comes back as follows:
Notice there is no
results
array insideruns
.Proposed solution
Include the
results
array inside each run in the SARIF file even if there are no issues returned bylintr
. I believe it should work if it's an empty array in that case (i.e."results": []
).Further reference
codeql-action
contributor regarding empty SARIF filescodeql-action
check for emptyrun.results
The text was updated successfully, but these errors were encountered: