diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index cf4e5889..c07083a5 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -28,12 +28,13 @@ jobs: run: mvn -B verify --file pom.xml - name: Scan with Sonar run: | - if [ $FORK = false ] + if [ $FORK = false ] || [ "$PUSH_REF" = "refs/heads/main" ] then mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=BerryCloud_xapi-java -Dsonar.organization=berry-cloud -Dsonar.host.url=https://sonarcloud.io --file pom.xml fi env: FORK: ${{ github.event.pull_request.head.repo.fork }} + PUSH_REF: ${{ github.event.ref }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}