Skip to content

Commit

Permalink
ci: 👷 added quality gate
Browse files Browse the repository at this point in the history
  • Loading branch information
paologaleotti committed Apr 2, 2024
1 parent 7c6f4bf commit 139fd42
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@

name: SonarCloud analysis

on:
push:
branches: [ "master" ]
branches: ["master"]
pull_request:
branches: [ "master" ]
branches: ["master"]
workflow_dispatch:

permissions:
Expand All @@ -23,8 +22,8 @@ jobs:
# uses: SonarSource/sonarcloud-github-action@de2e56b42aa84d0b1c5b622644ac17e505c9a049
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret)
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret)
with:
# Additional arguments for the sonarcloud scanner
args:
Expand All @@ -40,3 +39,20 @@ jobs:
#-Dsonar.tests= # optional. For more info about Code Coverage, please refer to https://docs.sonarcloud.io/enriching/test-coverage/overview/
# Adds more detail to both client and server-side analysis logs, activating DEBUG mode for the scanner, and adding client-side environment variables and system properties to the server-side log of analysis report processing.
#-Dsonar.verbose= # optional, default is false
- name: Quality Gate check
uses: sonarsource/sonarqube-quality-gate-action@master
# Force to fail step after specific time.
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Send Telegram notification on failure
uses: appleboy/telegram-action@master
if: failure()
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
[blaze🔥] Quality gate failed!
Commit: ${{ github.event.commits[0].message }}
Check the logs here: ${{ github.run_id }}

0 comments on commit 139fd42

Please sign in to comment.