|
29 | 29 | name: SonarCloud analysis |
30 | 30 |
|
31 | 31 | on: |
| 32 | + # Trigger analysis when pushing to your main branches, and when creating a pull request. |
32 | 33 | push: |
33 | | - branches: [ "main" ] |
| 34 | + branches: |
| 35 | + - main |
| 36 | + - 'releases/**' |
34 | 37 | pull_request: |
35 | | - branches: [ "main" ] |
36 | | - workflow_dispatch: |
| 38 | + types: [opened, synchronize, reopened] |
37 | 39 |
|
38 | 40 | permissions: |
39 | 41 | pull-requests: read # allows SonarCloud to decorate PRs with analysis results |
40 | 42 |
|
41 | 43 | jobs: |
42 | | - Analysis: |
| 44 | + sonarqube: |
43 | 45 | runs-on: ubuntu-latest |
44 | | - |
45 | 46 | steps: |
46 | | - - name: Analyze with SonarCloud |
47 | | - |
48 | | - # You can pin the exact commit or the version. |
49 | | - # uses: SonarSource/sonarcloud-github-action@de2e56b42aa84d0b1c5b622644ac17e505c9a049 |
50 | | - uses: SonarSource/sonarcloud-github-action@de2e56b42aa84d0b1c5b622644ac17e505c9a049 |
51 | | - env: |
52 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information |
53 | | - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret) |
| 47 | + - uses: actions/checkout@v4 |
| 48 | + with: |
| 49 | + # Disabling shallow clones is recommended for improving the relevancy of reporting |
| 50 | + fetch-depth: 0 |
| 51 | + - name: SonarQube Scan |
| 52 | + uses: SonarSource/sonarqube-scan-action@v5.2.0 # Ex: v4.1.0, See the latest version at https://github.com/marketplace/actions/official-sonarqube-scan |
| 53 | + env: |
| 54 | + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
54 | 55 | with: |
55 | 56 | # Additional arguments for the sonarcloud scanner |
56 | 57 | args: |
57 | 58 | # Unique keys of your project and organization. You can find them in SonarCloud > Information (bottom-left menu) |
58 | 59 | # mandatory |
59 | 60 | -Dsonar.projectKey=MobileID-Strong-Authentication_mobileid-client-java |
60 | 61 | -Dsonar.organization=mobileid-strong-authentication |
61 | | - # Comma-separated paths to directories containing main source files. |
62 | | - #-Dsonar.sources= # optional, default is project base directory |
63 | | - # When you need the analysis to take place in a directory other than the one from which it was launched |
64 | | - #-Dsonar.projectBaseDir= # optional, default is . |
65 | | - # Comma-separated paths to directories containing test source files. |
66 | | - #-Dsonar.tests= # optional. For more info about Code Coverage, please refer to https://docs.sonarcloud.io/enriching/test-coverage/overview/ |
67 | | - # Adds more detail to both client and server-side analysis logs, activating DEBUG mode for the scanner, and adding client-side environment variables and system properties to the server-side log of analysis report processing. |
68 | | - #-Dsonar.verbose= # optional, default is false |
0 commit comments