forked from cr0hn/vulnerable-node
-
Notifications
You must be signed in to change notification settings - Fork 5
58 lines (51 loc) · 3.2 KB
/
ghaction-sonarcloud-sample.yml
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# This is a basic workflow to help you get started with Actions
name: NOT SUPPOSED TO RUN
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches:
pull_request:
branches:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: SonarCloud Scan
# 1. Import your project to SonarCloud.
# 2. Import it on SonarCloud
# * Open sonarcloud.io, connect with your GitHub account and add your GitHub organization and your repository as a new project.
# * Please note that your project might be ready for AutoScan which means that it will be analysed without the need for GitHub Actions (it will be built automatically).
# If you still want to enable the GitHub Actions analysis, you can go to Administration > Analysis Method and disable “SonarCloud Automatic Analysis“.
#
# 3. Copy/paste Projet Key and Organization Key in the args below
# * On SonarCloud, click on Information at the bottom left
# 4. Generate a new token and add it to your Github's repository Secrets as SONAR_TOKEN
# * On SonarCloud, click on your avatar on top-right > My account > Security
# You may pin to the exact commit or the version.
# uses: SonarSource/sonarcloud-github-action@de2e56b42aa84d0b1c5b622644ac17e505c9a049
uses: SonarSource/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
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)
with:
# Additional arguments to the sonarcloud scanner
args: >
# Set the sonar.projectBaseDir analysis property
projectBaseDir: . # optional, default is .
# Unique key of your project. You can find it in SonarCloud > Information (bottom-left menu)
-Dsonar.projectKey= # mandatory
# Unique organisation key of your project. You can find it in SonarCloud > Information (bottom-left menu)
-Dsonar.organization= # mandatory
# Comma-separated paths to directories containing main source files.
-Dsonar.sources= # optional, default is project base directory
# Comma-separated paths to directories containing test source files.
-Dsonar.tests= # optional
# 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.
-Dsonar.verbose= # optional, default is false