You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Sonar Scanner for Maven requires that the project is built before the analysis.
2
+
# Yet, running the Sonar Scanner action without building the project yields some results.
3
+
# 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.
4
+
name: SonarCloud (Source Only)
5
+
on:
6
+
push:
7
+
branches:
8
+
- main
9
+
pull_request:
10
+
types: [ opened, synchronize, reopened ]
11
+
workflow_dispatch:
12
+
13
+
jobs:
14
+
build:
15
+
name: Build and Analyze (Source Only)
16
+
runs-on: ubuntu-latest
17
+
steps:
18
+
- uses: actions/checkout@v4
19
+
with:
20
+
fetch-depth: 0# Shallow clones should be disabled for a better relevancy of analysis
21
+
22
+
- name: Analyze Source Only
23
+
uses: sonarsource/sonarqube-scan-action@v2
24
+
with:
25
+
args: >
26
+
-Dsonar.host.url=https://sonarcloud.io
27
+
-Dsonar.organization=pixee
28
+
-Dsonar.projectKey=pixee_bad-java-code
29
+
-Dsonar.sources=src/main/java
30
+
-Dsonar.java.binaries=.
31
+
-Dsonar.sourceEncoding=UTF-8
32
+
env:
33
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
0 commit comments