Skip to content

Commit f872e92

Browse files
Feature: Integrate SonarCloud (#17)
* feat(workflows): add sonarqube workflow for ci/cd * feat(workflows): create sonar-project.properties for sonarcloud setup Add initial SonarCloud configuration for the project * feat(workflows): add quality gate status badge to README * fix(workflows): potential fix for code scanning alert no. 10 workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent f0d48ef commit f872e92

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

.github/workflows/sonar.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Build
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
permissions:
9+
contents: read
10+
jobs:
11+
sonarqube:
12+
name: SonarQube
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
18+
- name: SonarQube Scan
19+
uses: SonarSource/sonarqube-scan-action@fd88b7d7ccbaefd23d8f36f73b59db7a3d246602
20+
env:
21+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=rmottanet_gitnap&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=rmottanet_gitnap)
2+
13
# GitNap: Bash Script Collection
24

35
## ctrl+s :v:

sonar-project.properties

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
sonar.projectKey=rmottanet_gitnap
2+
sonar.organization=rmottanet
3+
4+
5+
# This is the name and version displayed in the SonarCloud UI.
6+
#sonar.projectName=gitnap
7+
#sonar.projectVersion=1.0
8+
9+
10+
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
11+
#sonar.sources=.
12+
13+
# Encoding of the source code. Default is default system encoding
14+
#sonar.sourceEncoding=UTF-8

0 commit comments

Comments
 (0)