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
Copy file name to clipboardExpand all lines: README.md
+22-36Lines changed: 22 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,60 +1,46 @@
1
1
# SonarQube Scanner GitHub Action
2
2
3
3
This repository provides a reusable GitHub Action for running SonarQube scans in GitHub Workflows.
4
-
It is designed to standardize the logic around the original [SonarQube Scanner Action](https://github.com/SonarSource/sonarqube-scan-action),
5
-
automatically handling details such as providing the correct branch name for pull requests and checking if the pull request is a fork.
6
-
7
-
## Features
8
-
9
-
- Standardizes the [SonarQube Scanner Action](https://github.com/SonarSource/sonarqube-scan-action) for consistent usage across projects
10
-
- Ability to configure the project base directory for SonarQube analysis
11
-
- Provide branch name to the scan action when running on pull requests
12
-
- Prevents the scan action from running on pull requests from forks by default
4
+
It wraps the official [SonarQube Scanner Action](https://github.com/SonarSource/sonarqube-scan-action) to standardize details such as providing the correct branch name for pull requests and checking if the pull request is made from a fork.
13
5
14
6
## Usage
15
7
16
-
Here is a basic example of how you can integrate it in your project.
17
-
18
-
<details>
19
-
<summary>Example workflow</summary>
20
-
21
-
This workflow is executed automatically on push to the main branch, on a pull request and can also be executed manually from the actions tab `workflow_dispatch`.
22
-
23
-
In the code below you need to replace `${{ secrets.SONAR_TOKEN }}` with the secret that contains the SonarQube token you want to use.
8
+
To use the action, add it to a workflow in your repository:
24
9
25
10
```yml
26
11
name: Run SonarCloud scanner
27
12
28
13
on:
29
-
workflow_dispatch:
30
-
pull_request:
31
-
push:
32
-
branches:
33
-
- main
14
+
workflow_dispatch:
15
+
pull_request:
16
+
push:
17
+
branches:
18
+
- main
34
19
35
20
jobs:
36
21
sonarcloud-scanner:
37
22
runs-on: ubuntu-latest
38
23
steps:
39
-
- name: Checkout repository
40
-
uses: actions/checkout@v4
41
-
42
-
# Using the action
43
-
- name: Install dependencies
44
-
uses: minvws/action-sonarcube-cloud@v1
45
-
with:
46
-
sonar-token: ${{ secrets.SONAR_TOKEN }}
24
+
- name: Checkout repository
25
+
uses: actions/checkout@v4
26
+
27
+
- name: Run SonarQube scan
28
+
uses: minvws/action-sonarcube-cloud@v1
29
+
with:
30
+
sonar-token: ${{ secrets.SONAR_TOKEN }}
47
31
```
48
32
49
-
</details>
33
+
Make sure to add the `SONAR_TOKEN` secret to your repository's configuration. See [Using secrets in GitHub Actions](https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/use-secrets).
34
+
35
+
In this basic example, the workflow is executed automatically on push to the `main` branch and on any pull request. And thanks to the `workflow_dispatch` trigger it can also be executed manually from the repository's Actions tab.
50
36
51
37
### Configuration
52
38
53
-
The action has inputs. The inputs are:
39
+
The action has the following inputs:
54
40
55
-
- sonar-token: the SonarQube token
56
-
- project-base-dir: set the sonar.projectBaseDir analysis property, default is `.`
57
-
- allow-run-on-fork: allow SonarQube scan to run on pull requests from forks (default: false)
41
+
- `sonar-token`: the SonarQube token.
42
+
- `project-base-dir`: set the sonar.projectBaseDir analysis property, default is `.`.
43
+
- `allow-run-on-fork`: allow SonarQube scan to run on pull requests from forks (default: false).
58
44
59
45
## Contribution
60
46
@@ -65,7 +51,7 @@ Git commits must be signed. Please check the [Signing commits documentation on G
65
51
66
52
## License
67
53
68
-
This repository is released under the EUPL 1.2 license. [See LICENSE](LICENSE.txt) for details.
54
+
This repository is released under the EUPL 1.2 license. [See LICENSE.txt](./LICENSE.txt) for details.
0 commit comments