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
the result is coming back as null