-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad19c24
commit 512b483
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Sonar | ||
'on': | ||
push: | ||
branches: | ||
- "**" | ||
pull_request_target: | ||
branches: | ||
- "**" | ||
types: [opened, synchronize, reopened, labeled] | ||
schedule: | ||
- cron: 0 16 * * * | ||
workflow_dispatch: | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 17 | ||
java-package: jdk | ||
|
||
- uses: actions/checkout@v1 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Check for external PR | ||
if: ${{ !(contains(github.event.pull_request.labels.*.name, 'safe') || | ||
github.event.pull_request.head.repo.full_name == github.repository || | ||
github.event_name != 'pull_request_target') }} | ||
run: echo "Unsecure PR, must be labelled with the 'safe' label, then run the workflow again" && exit 1 | ||
|
||
- name: Build with Maven | ||
|
||
mvn clean install | ||
|
||
- name: Sonar Scan | ||
env: | ||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | ||
SONAR_TOKEN: '${{ secrets.SONAR_TOKEN }}' | ||
run: >- | ||
mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar | ||
-Dsonar.projectName=client-encryption-java | ||
-Dsonar.projectKey=Mastercard_client-encryption-java | ||
-Dsonar.organization=mastercard -Dsonar.host.url=https://sonarcloud.io | ||
-Dsonar.login=$SONAR_TOKEN -Dsonar.cpd.exclusions=**/OkHttp*.java | ||
-Dsonar.exclusions=**/*.xml -Dgpg.signature.skip=true | ||