-
Notifications
You must be signed in to change notification settings - Fork 1
34 lines (32 loc) · 1.22 KB
/
sonar-source-analysis.yaml
File metadata and controls
34 lines (32 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Sonar Scanner for Maven requires that the project is built before the analysis.
# Yet, running the Sonar Scanner action without building the project yields some results.
# This action uses this edge-case set-up, to help us understand what results we can expect when using Sonar Scanner action to analyze Java source files.
name: SonarCloud (Source Only)
on:
push:
branches:
- main
pull_request:
types: [ opened, synchronize, reopened ]
workflow_dispatch:
jobs:
build:
name: Build and Analyze (Source Only)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Analyze Source Only
uses: sonarsource/sonarqube-scan-action@v2
with:
args: >
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.organization=pixee
-Dsonar.projectKey=pixee_bad-java-code
-Dsonar.sources=src/main/java
-Dsonar.java.binaries=.
-Dsonar.sourceEncoding=UTF-8
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}