File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 9999 run-arguments : --workspace ${{ steps.paths.outputs.sfCodeAnalyzerPathToValidate }} --view detail --output-file sfca_results.html --output-file sfca_results.json --output-file code-analyzer-report.sarif
100100 results-artifact-name : salesforce-code-analyzer-results
101101
102+ # Code Analyser generates an empty SARIF file if no violations are found.
103+ # In that case this step ensures that the SARIF file is valid and contains a default structure.
104+ # This is required for the SARIF file to be uploaded to GitHub.
105+ - name : Check SARIF file
106+ if : ${{ !cancelled() && steps.paths.outcome == 'success' }}
107+ run : |
108+ echo "::group::Check SARIF file"
109+ jq --arg wd "$GITHUB_WORKSPACE" '
110+ if .runs == [] then
111+ .runs = [
112+ {
113+ "tool": {
114+ "driver": {
115+ "name": "pmd",
116+ "rules": []
117+ }
118+ },
119+ "results": [],
120+ "invocations": [
121+ {
122+ "executionSuccessful": true,
123+ "workingDirectory": {
124+ "uri": $wd
125+ }
126+ }
127+ ]
128+ }
129+ ]
130+ else
131+ .
132+ end
133+ ' code-analyzer-report.sarif > code-analyzer-report.sarif
134+ echo "::endgroup::"
135+
102136 - name : Upload SARIF file
103137 uses : github/codeql-action/upload-sarif@7e3036b9cd87fc26dd06747b7aa4b96c27aaef3a
104138 if : ${{ !cancelled() && steps.paths.outcome == 'success' && github.ref_name == 'main' }}
You can’t perform that action at this time.
0 commit comments