Sonar for PRs #96
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sonar for PRs | |
on: | |
workflow_run: | |
workflows: ['PRs'] | |
types: [completed] | |
jobs: | |
sonar: | |
name: Sonar | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
if: github.event.workflow_run.conclusion == 'success' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.workflow_run.head_repository.full_name }} | |
ref: ${{ github.event.workflow_run.head_branch }} | |
fetch-depth: 0 | |
- name: Debug Workflow Info | |
run: | | |
echo "Workflow Run ID: ${{ github.event.workflow_run.id }}" | |
echo "Workflow Head SHA: ${{ github.event.workflow_run.head_sha }}" | |
echo "Current SHA: ${{ github.sha }}" | |
echo "Head Branch: ${{ github.event.workflow_run.head_branch }}" | |
echo "Repository: ${{ github.event.workflow_run.head_repository.full_name }}" | |
# Output raw context for additional details | |
echo "=== Raw Context ===" | |
echo "Workflow Head SHA: ${{ github.event.workflow_run }}" | |
- name: 'Raw Context' | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
JSON.stringify(${{ github.event.workflow_run }}, null, 2) | |
# Download reports | |
- uses: ./.github/actions/download-coverage-report | |
- uses: ./.github/actions/download-lint-report | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarqube-scan-action@v4.2.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONARQUBE_SCANNER }} | |
with: | |
args: > | |
-Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }} | |
-Dsonar.pullrequest.key=${{ github.event.workflow_run.pull_requests[0].number }} | |
-Dsonar.pullrequest.branch=${{ github.event.workflow_run.pull_requests[0].head.ref }} | |
-Dsonar.pullrequest.base=${{ github.event.workflow_run.pull_requests[0].base.ref }} |