Upcoming Webinar!
Maintain excellence in code health with AI Code Assurance - Register Now!
Sonar Community
Result of quality gate status is coming back as null
SonarQube Cloud
demola-gigxpad
(Demola Gigxpad)
January 6, 2023, 10:15am
1
ALM used GitHub
CI system used GitHub actions
jobs:
sonarcloud:
#needs:
[ on-success ]
name: SonarCloud
runs-on: ubuntu-latest
steps:
uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis…
name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.PAT }} # Needed to get PR information, if any exist
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
#run:
npx sonarqube-scanner
name: Get SonarCloud quality gate status
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
RESULT=$(curl -u “$SONAR_TOKEN:” “
https://sonarcloud.io/api/qualitygates/project_status?projectKey=GIGXPad-com_xpad-web-v2&analysisId=$SONAR_ANALYSIS_ID
”)
STATUS=$(echo $RESULT | jq -r .status)
echo $STATUS
name: Check quality gate status
if: ${{ env.STATUS == ‘ERROR’ }}
run: |
echo “Quality gate status is ERROR”
exit 1
Colin
(Colin)
January 9, 2023, 11:08am
2
Hey there.
Please don’t raise duplicate threads. I will close this one.
Related topics
Topic
Replies
Views
Activity
How to show Quality Gate status after run Sonarscan by Github Action to PR checks tab or comment
SonarQube Cloud
coverage
,
github-checks
,
github-actions
6
1966
April 24, 2023
Get quality gate result from SonarCloud analysis with GitHub Actions
SonarQube Cloud
typescript
,
sonarqube-cloud
5
85
December 10, 2024
Get quality gate result from SonarCloud analysis with GitHub Actions
SonarQube Cloud
sonarqube-cloud
3
2483
September 29, 2021
Make GH Action Job of Sonarcloud scan fail when quality gate is not passed
SonarQube Cloud
8
1329
December 16, 2022
Error running solarcloud analysis
SonarQube Cloud
4
2125
November 13, 2023