Skip to content

Commit 05fa3af

Browse files
committed
Disable Sonar analysis on external PRs
1 parent 29b3421 commit 05fa3af

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

.github/workflows/pull-request.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,27 +53,34 @@ jobs:
5353
name: Sonar analysis
5454
needs: validation
5555
runs-on: ubuntu-latest
56+
env:
57+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
5658
steps:
5759
- uses: actions/checkout@v2
60+
if: env.SONAR_TOKEN != null
5861
with:
5962
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
6063
- name: Set up JDK 11
64+
if: success()
6165
uses: actions/setup-java@v1
6266
with:
6367
java-version: 11
6468
- name: Cache SonarCloud packages
69+
if: success()
6570
uses: actions/cache@v1
6671
with:
6772
path: ~/.sonar/cache
6873
key: ${{ runner.os }}-sonar
6974
restore-keys: ${{ runner.os }}-sonar
7075
- name: Cache Gradle packages
76+
if: success()
7177
uses: actions/cache@v1
7278
with:
7379
path: ~/.gradle/caches
7480
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
7581
restore-keys: ${{ runner.os }}-gradle
7682
- name: Build and analyze
83+
if: success()
7784
env:
7885
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
7986
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)