mirror of
https://github.com/sonarsource/sonarcloud-github-action.git
synced 2026-06-06 01:47:07 +00:00
Add args option to action (#9)
This commit is contained in:
parent
c35654669e
commit
f4c6e4d91e
4 changed files with 43 additions and 19 deletions
17
Dockerfile
17
Dockerfile
|
|
@ -1,13 +1,13 @@
|
|||
FROM sonarsource/sonar-scanner-cli:4.3
|
||||
|
||||
LABEL version="0.0.1"
|
||||
LABEL repository="https://github.com/sonarsource/sonarcloud-github-action"
|
||||
LABEL homepage="https://github.com/sonarsource/sonarcloud-github-action"
|
||||
LABEL maintainer="SonarSource"
|
||||
LABEL "com.github.actions.name"="SonarCloud Scan"
|
||||
LABEL "com.github.actions.description"="Scan your code with SonarCloud to detect bugs, vulnerabilities and code smells in more than 25 programming languages."
|
||||
LABEL "com.github.actions.icon"="check"
|
||||
LABEL "com.github.actions.color"="green"
|
||||
LABEL version="0.0.1" \
|
||||
repository="https://github.com/sonarsource/sonarcloud-github-action" \
|
||||
homepage="https://github.com/sonarsource/sonarcloud-github-action" \
|
||||
maintainer="SonarSource" \
|
||||
com.github.actions.name="SonarCloud Scan" \
|
||||
com.github.actions.description="Scan your code with SonarCloud to detect bugs, vulnerabilities and code smells in more than 25 programming languages." \
|
||||
com.github.actions.icon="check" \
|
||||
com.github.actions.color="green"
|
||||
|
||||
ARG SONAR_SCANNER_HOME=/opt/sonar-scanner
|
||||
ARG NODEJS_HOME=/opt/nodejs
|
||||
|
|
@ -19,6 +19,7 @@ WORKDIR /opt
|
|||
# https://help.github.com/en/actions/creating-actions/dockerfile-support-for-github-actions#user
|
||||
USER root
|
||||
|
||||
# Prepare entrypoint
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
|
|
|||
20
README.md
20
README.md
|
|
@ -59,6 +59,26 @@ with:
|
|||
projectBaseDir: my-custom-directory
|
||||
```
|
||||
|
||||
In case you need to add additional analysis parameters, you can use the `args` option:
|
||||
|
||||
```yaml
|
||||
- name: Analyze with SonarCloud
|
||||
uses: sonarsource/sonarcloud-github-action@master
|
||||
with:
|
||||
projectBaseDir: my-custom-directory
|
||||
args: >
|
||||
-Dsonar.organization=my-organization
|
||||
-Dsonar.projectKey=my-projectkey
|
||||
-Dsonar.python.coverage.reportPaths=coverage.xml
|
||||
-Dsonar.sources=lib/
|
||||
-Dsonar.test.exclusions=tests/**
|
||||
-Dsonar.tests=tests/
|
||||
-Dsonar.verbose=true
|
||||
```
|
||||
|
||||
More information about possible analysis parameters is found in the documentation at:
|
||||
https://sonarcloud.io/documentation/analysis/analysis-parameters/
|
||||
|
||||
### Secrets
|
||||
|
||||
- `SONAR_TOKEN` – **Required** this is the token used to authenticate access to SonarCloud. You can generate a token on your [Security page in SonarCloud](https://sonarcloud.io/account/security/). You can set the `SONAR_TOKEN` environment variable in the "Secrets" settings page of your repository.
|
||||
|
|
|
|||
23
action.yml
23
action.yml
|
|
@ -1,13 +1,18 @@
|
|||
name: 'SonarCloud Scan'
|
||||
description: 'Scan your code with SonarCloud to detect bugs, vulnerabilities and code smells in more than 25 programming languages.'
|
||||
name: SonarCloud Scan
|
||||
description: >
|
||||
Scan your code with SonarCloud to detect bugs, vulnerabilities and code smells
|
||||
in more than 25 programming languages.
|
||||
branding:
|
||||
icon: 'check'
|
||||
color: 'green'
|
||||
icon: check
|
||||
color: green
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
using: docker
|
||||
image: Dockerfile
|
||||
inputs:
|
||||
projectBaseDir:
|
||||
description: 'Set the sonar.projectBaseDir analysis property'
|
||||
args:
|
||||
description: Additional arguments to the sonarcloud scanner
|
||||
required: false
|
||||
default: '.'
|
||||
projectBaseDir:
|
||||
description: Set the sonar.projectBaseDir analysis property
|
||||
required: false
|
||||
default: .
|
||||
|
|
|
|||
|
|
@ -21,6 +21,4 @@ if [[ -z "${SONARCLOUD_URL}" ]]; then
|
|||
SONARCLOUD_URL="https://sonarcloud.io"
|
||||
fi
|
||||
|
||||
sonar-scanner -Dsonar.projectBaseDir=${INPUT_PROJECTBASEDIR} -Dsonar.host.url=${SONARCLOUD_URL}
|
||||
|
||||
|
||||
sonar-scanner -Dsonar.projectBaseDir=${INPUT_PROJECTBASEDIR} -Dsonar.host.url=${SONARCLOUD_URL} ${INPUT_ARGS}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue