|
20 | 20 | analyze: |
21 | 21 | name: Analyze (${{ matrix.language }}) |
22 | 22 | runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} |
23 | | - env: |
24 | | - # PRs for forks can't use secrets, can't upload to Sonar |
25 | | - CAN_USE_SECRETS: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} |
26 | 23 | permissions: |
27 | 24 | # required for all workflows |
28 | 25 | security-events: write |
@@ -117,17 +114,39 @@ jobs: |
117 | 114 | name: codeql-artifacts-${{ matrix.language }} |
118 | 115 | path: ${{ env.RESULTS_DIR }} |
119 | 116 |
|
| 117 | + sonar: |
| 118 | + name: SonarQube Scan |
| 119 | + needs: analyze |
| 120 | + runs-on: ubuntu-latest |
| 121 | + # PRs for forks can't use secrets, can't upload to Sonar |
| 122 | + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository |
| 123 | + permissions: |
| 124 | + actions: read |
| 125 | + contents: read |
| 126 | + steps: |
| 127 | + - name: Checkout repository |
| 128 | + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 #v4.3.1 |
| 129 | + with: |
| 130 | + fetch-depth: 0 |
| 131 | + |
| 132 | + - name: Download CodeQL Artifacts |
| 133 | + uses: actions/download-artifact@v4 |
| 134 | + with: |
| 135 | + pattern: codeql-artifacts-* |
| 136 | + path: codeql-results |
| 137 | + |
120 | 138 | - name: collect stripped .sarif file paths |
121 | | - if: env.CAN_USE_SECRETS == 'true' |
122 | 139 | shell: bash |
123 | 140 | run: | |
124 | | - sarif_paths="$(find "${{ github.workspace }}/../results" -name '*_stripped.sarif' -type f | paste -sd, -)" |
| 141 | + echo "downloaded CodeQL artifact files:" |
| 142 | + find "${{ github.workspace }}/codeql-results" -type f | sort |
| 143 | +
|
| 144 | + sarif_paths="$(find "${{ github.workspace }}/codeql-results" -name '*_stripped.sarif' -type f | paste -sd, -)" |
125 | 145 | echo "sarif paths: $sarif_paths" |
126 | 146 | test -n "$sarif_paths" |
127 | 147 | echo "SARIF_REPORT_PATHS=$sarif_paths" >> "$GITHUB_ENV" |
128 | 148 |
|
129 | 149 | - name: SonarQube Scan |
130 | | - if: env.CAN_USE_SECRETS == 'true' |
131 | 150 | uses: SonarSource/sonarqube-scan-action@7006c4492b2e0ee0f816d36501671557c97f5995 # v8.1.0 |
132 | 151 | env: |
133 | 152 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
|
0 commit comments