|
1 | | -# Setup SonarQube for a Node.js project with Github Action |
| 1 | +# Setup SonarCloud for a Node.js project with Github Action |
2 | 2 |
|
3 | | -> This sample app demonstrate how to set up SonarQube with GitHub Actions for a Node.js project |
| 3 | +> This sample app demonstrate how to set up SonarCloud with GitHub Actions for a Node.js project |
4 | 4 |
|
5 | 5 |
|
6 | 6 | ## 🛠 Basic Setup - step by step |
7 | 7 |
|
8 | | -- You should have a SonarQube server (self-hosted) OR you can use SonarCloud https://www.sonarsource.com/products/sonarcloud/ [Here in this repo we will be using sonarcloud] |
| 8 | +- You should have a SonarQube server (self-hosted) OR you can use SonarCloud https://www.sonarsource.com/products/sonarcloud/ [Here in this repo we will be using SonarCloud] |
9 | 9 | - Sign in with GitHub |
10 | 10 | - After login create SonarQube Token: In SonarQube UI → My Account → Security → Generate Token |
11 | 11 | - Import your organization / repository |
|
14 | 14 | - Name: SONAR_TOKEN |
15 | 15 | - value: your generated token |
16 | 16 | - Name: SONAR_HOST_URL |
17 | | - - value: use https://your-sonarqube-server.com if using sonarqube or else use https://sonarcloud.io for sonarcloud |
| 17 | + - value: use https://your-sonarqube-server.com if using SonarQube or else use https://sonarcloud.io for SonarCloud |
18 | 18 | - Create a file called sonar-project.properties and keep it in root of project: |
19 | 19 | ```bash |
20 | 20 | sonar.projectKey=<YOUR_PROJECT_KEY> |
|
24 | 24 | sonar.language=js |
25 | 25 | ``` |
26 | 26 | This tells SonarScanner how to scan your project. |
27 | | -- Add GitHub Action Workflow (.github/workflows/sonarqube.yml): code is provided in the Repo. |
| 27 | +- Add GitHub Action Workflow (.github/workflows/sonarcloud.yml): code is provided in the Repo. |
28 | 28 |
|
29 | 29 | ## 🔥 How does it work? |
30 | 30 | - Whenever your code is pushed or a PR is created, GitHub Action runs, SonarQube scanner checks your code and update SonarQube dashboard with report |
|
33 | 33 |
|
34 | 34 | ```bash |
35 | 35 | # Clone the repo |
36 | | -git clone https://github.com/rupachowrasia/nodejs-sonarqube-setup-with-github-action.git |
| 36 | +git clone https://github.com/rupachowrasia/nodejs-sonarcloud-setup-with-github-action.git |
37 | 37 |
|
38 | 38 | # Move into the project directory |
39 | | -cd nodejs-sonarqube-setup-with-github-action |
| 39 | +cd nodejs-sonarcloud-setup-with-github-action |
40 | 40 |
|
41 | 41 | # Install dependencies |
42 | 42 | npm install |
|
0 commit comments