Skip to content

Commit 34cfa51

Browse files
authored
Pass more args to Sonar (#2358)
* Pass projectVersion to Sonar * Fix s'more * Fix sonar.lang.patterns.ts * Apply more tweaks Based on https://community.sonarsource.com/t/how-to-use-sonarcloud-with-a-forked-repository-on-github/7363/28
1 parent 685276f commit 34cfa51

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

.github/workflows/sonarqube.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v3
1414
with:
15-
ref: ${{ github.event.workflow_run.head_sha }} # checkout commit that triggered this workflow
15+
repository: ${{ github.event.workflow_run.head_repository.full_name }}
16+
ref: ${{ github.event.workflow_run.head_branch }} # checkout commit that triggered this workflow
1617
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
1718

1819
# fetch develop so that Sonar can identify new issues in PR builds
@@ -56,6 +57,9 @@ jobs:
5657
args: >
5758
-Dsonar.projectVersion=${{ steps.version.outputs.tag }}
5859
-Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }}
60+
-Dsonar.pullrequest.key=${{ github.event.workflow_run.pull_requests[0].number }}
61+
-Dsonar.pullrequest.branch=${{ github.event.workflow_run.pull_requests[0].head.ref }}
62+
-Dsonar.pullrequest.base=${{ github.event.workflow_run.pull_requests[0].base.ref }}
5963
env:
6064
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
6165
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)