Skip to content

Commit

Permalink
Only run sonar if token is present
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpoole committed Sep 2, 2021
1 parent 26e88a2 commit 39fdf41
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ on:
jobs:
test:
runs-on: macos-latest

env:
# Needed to get some information about the pull request, if any
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SonarCloud access token should be generated from https://sonarcloud.io/account/security/
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

steps:
- name: checkout
uses: actions/checkout@v2
Expand All @@ -32,10 +39,7 @@ jobs:
- name: Generate coverage report
run: ./gradlew jacocoTestReport
- name: SonarCloud Scan
# only do this step if we have a token for sonar
if: ${{ env.SONAR_TOKEN }}
# note as we don't wait for processing to complete this will always succeed
run: ./gradlew sonarqube -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=simonpoole-github --info
env:
# Needed to get some information about the pull request, if any
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SonarCloud access token should be generated from https://sonarcloud.io/account/security/
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 comments on commit 39fdf41

Please sign in to comment.