diff --git a/.github/workflows/sonar_pr.yml b/.github/workflows/sonar_pr.yml index dcf50738..98230cd4 100644 --- a/.github/workflows/sonar_pr.yml +++ b/.github/workflows/sonar_pr.yml @@ -1,10 +1,9 @@ name: SonarCloud -# on: -# pull_request_target: -# branches: -# - main -# types: [ opened, synchronize, reopened ] -on: [ push, workflow_dispatch ] +on: + pull_request_target: + branches: + - main + types: [ opened, synchronize, reopened ] jobs: build: @@ -26,18 +25,17 @@ jobs: path: ~/.sonar/cache key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar - # - name: Cache Maven packages - # uses: actions/cache@v3 - # with: - # path: ~/.m2 - # key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - # restore-keys: ${{ runner.os }}-m2 + - name: Cache Maven packages + uses: actions/cache@v3 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 - name: Build and analyze env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: > - mvn clean; mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=WSA-Utopia-Discord-Bot -Dsonar.organization=waterball-software-academy