Sonarqube #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sonarqube | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
permissions: # permission to comment a PR | |
contents: read | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- uses: sonarsource/sonarqube-scan-action@master | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | |
# If you wish to fail your job when the Quality Gate is red, uncomment the following lines. | |
# Check the Quality Gate status. | |
# - name: SonarQube Quality Gate check | |
# id: sonarqube-quality-gate-check | |
# uses: sonarsource/sonarqube-quality-gate-action@master | |
# # #Enforce a timeout to fail the step after a specific time. | |
# timeout-minutes: 5 | |
# env: | |
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
# SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} # OPTIONAL | |
# PR Decoration | |
- name: SonarQube Pull Request Comment | |
if: always() | |
uses: campos-pay/sonarqube-pr-comment@main | |
with: | |
sonar_token: ${{ secrets.SONAR_TOKEN }} | |
sonar_host_url: ${{ secrets.SONAR_HOST_URL }} | |
sonar_projectkey: ${{ vars.SONAR_PROJECT_KEY }} #github.event.repository.name | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
repo_name: ${{ github.repository }} | |
pr_number: ${{ github.event.pull_request.number }} | |
- uses: phwt/sonarqube-quality-gate-action@v1 | |
id: quality-gate-check | |
with: | |
sonar-project-key: ${{ vars.SONAR_PROJECT_KEY }} | |
sonar-host-url: ${{ secrets.SONAR_HOST_URL }} | |
sonar-token: ${{ secrets.SONAR_TOKEN }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} #PR_GITHUB_TOKEN | |
- name: Output result | |
run: | | |
echo "${{ steps.quality-gate-check.outputs.project-status }}" | |
echo "${{ steps.quality-gate-check.outputs.quality-gate-result }}" | |