From ecfebc5227f8862c7055dc7531b3c15864e77f30 Mon Sep 17 00:00:00 2001 From: Ken Huang <100591800+m1a2st@users.noreply.github.com> Date: Tue, 24 Oct 2023 00:13:54 +0800 Subject: [PATCH] Update sonar_pr.yml --- .github/workflows/sonar_pr.yml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) 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