|
79 | 79 | if: matrix.language == 'cpp' |
80 | 80 | run: | |
81 | 81 | sarif_file="sarif-results/${{ matrix.language }}.sarif" |
82 | | -
|
83 | | - if [ -f "$sarif_file" ] && [ -f "renamed_files.json" ]; then |
84 | | - echo "Processing SARIF file: $sarif_file" |
85 | | -
|
86 | | - # Read the renamed files mapping |
87 | | - renamed_files=$(cat renamed_files.json) |
88 | | -
|
89 | | - # Create a backup of the original SARIF |
90 | | - cp "$sarif_file" "${sarif_file}.backup" |
91 | | -
|
92 | | - # Process the SARIF file to rename files back to .ino and adjust line numbers |
93 | | - jq --argjson renamed "$renamed_files" ' |
94 | | - .runs[0].results |= map( |
95 | | - if .locations[0].physicalLocation.artifactLocation.uri in $renamed then |
96 | | - .locations[0].physicalLocation.artifactLocation.uri = $renamed[.locations[0].physicalLocation.artifactLocation.uri] | |
97 | | - if .locations[0].physicalLocation.region.startLine then |
98 | | - .locations[0].physicalLocation.region.startLine = (.locations[0].physicalLocation.region.startLine - 1) |
99 | | - else . |
100 | | - end | |
101 | | - if .locations[0].physicalLocation.region.endLine then |
102 | | - .locations[0].physicalLocation.region.endLine = (.locations[0].physicalLocation.region.endLine - 1) |
103 | | - else . |
104 | | - end |
105 | | - else . |
106 | | - end |
107 | | - ) |
108 | | - ' "$sarif_file" > "${sarif_file}.processed" |
109 | | -
|
110 | | - # Replace the original SARIF with the processed version |
111 | | - mv "${sarif_file}.processed" "$sarif_file" |
112 | | -
|
113 | | - echo "SARIF file processed successfully" |
114 | | - else |
115 | | - echo "SARIF file or renamed files mapping not found, skipping processing" |
116 | | - fi |
| 82 | + .github/scripts/sarif_nobuild.sh "$sarif_file" "renamed_files.json" |
117 | 83 |
|
118 | 84 | - name: Upload SARIF file |
119 | 85 | uses: github/codeql-action/upload-sarif@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2 |
|
0 commit comments