Result of quality gate status is coming back as null

  • 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

Hey there.

Please don’t raise duplicate threads. I will close this one.