Skip to content

Commit 857d378

Browse files
authored
Update to remove sonar from PR from fork (#2446)
2 parents ae06309 + 83dbae6 commit 857d378

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ jobs:
265265
steps:
266266
- name: Set up JDK 17
267267
uses: actions/setup-java@v2
268+
if: ${{ !(github.event.pull_request.head.repo.fork) }}
268269
with:
269270
java-version: 17
270271
distribution: 'zulu'
@@ -285,8 +286,12 @@ jobs:
285286
run: |
286287
Get-Item -Path .\
287288
Get-ChildItem -Path .\ -Recurse -Filter '*.sln' | ForEach-Object { $_.FullName }
288-
- run: dotnet tool install --global dotnet-sonarscanner
289-
- run: dotnet sonarscanner begin
289+
- name: sonar install
290+
if: ${{ !(github.event.pull_request.head.repo.fork) }}
291+
run: dotnet tool install --global dotnet-sonarscanner
292+
- name: sonar begin
293+
if: ${{ !(github.event.pull_request.head.repo.fork) }}
294+
run: dotnet sonarscanner begin
290295
/o:"nkdagility"
291296
/k:"vsts-sync-migrator:master"
292297
/d:sonar.host.url="https://sonarcloud.io"
@@ -309,7 +314,9 @@ jobs:
309314
- run: dotnet test "MigrationTools.sln" --results-directory ".\test-results\" --logger trx --collect "Code coverage" --no-build --filter "(TestCategory=L0|TestCategory=L1)"
310315
- run: dotnet test "MigrationTools.sln" --results-directory ".\test-results\" --logger trx --collect "Code coverage" --no-build --filter "(TestCategory=L2|TestCategory=L3)"
311316
- run: dotnet test "MigrationTools.sln" --results-directory ".\test-results\" --logger trx --collect "Code coverage" --no-build --filter "(TestCategory!=L0&TestCategory!=L1&TestCategory!=L2&TestCategory!=L3)"
312-
- run: dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
317+
- name: sonar end
318+
if: ${{ !(github.event.pull_request.head.repo.fork) }}
319+
run: dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
313320
- name: "Package Executable Files"
314321
id: packageExecutable
315322
shell: pwsh

0 commit comments

Comments
 (0)