Skip to content

Commit c146634

Browse files
Refactor Sonar scan step in Maven workflow
Updated Sonar scan command to include build verification and fixed formatting.
1 parent c232e89 commit c146634

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

.github/workflows/maven_pull_request.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ jobs:
2121
- name: Build with Maven
2222
run: mvn -B verify --file pom.xml
2323
- name: Scan with Sonar
24+
env:
25+
FORK: ${{ github.event.pull_request.head.repo.fork }}
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
27+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
2428
run: |
2529
if [ $FORK = false ]
2630
then
27-
mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=BerryCloud_xapi-java -Dsonar.organization=berrycloud -Dsonar.host.url=https://sonarcloud.io --file pom.xml
31+
mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=BerryCloud_xapi-java
32+
mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=BerryCloud_xapi-java --file pom.xml
2833
fi
29-
env:
30-
FORK: ${{ github.event.pull_request.head.repo.fork }}
31-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
32-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)