diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml new file mode 100644 index 0000000..1fdfb77 --- /dev/null +++ b/.github/workflows/sonarqube.yml @@ -0,0 +1,33 @@ +name: Check quality gate result on pull request + +on: + push: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - uses: sonarsource/sonarqube-scan-action@v4.1.0 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + + - name: Wait for the quality gate result + run: sleep 5 + + - uses: phwt/sonarqube-quality-gate-action@v1 + id: quality-gate-check + with: + sonar-project-key: ${{ secrets.SONAR_PROJECT_KEY }} + sonar-host-url: ${{ secrets.SONAR_HOST_URL }} + sonar-token: ${{ secrets.SONAR_TOKEN }} + github-token: ${{ secrets.SONAR_GITHUB_TOKEN }} + branch: main # Optional input + + - name: Output result + run: | + echo "${{ steps.quality-gate-check.outputs.project-status }}" + echo "${{ steps.quality-gate-check.outputs.quality-gate-result }}" diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..0faf823 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1 @@ +sonar.projectKey=Redback-Operations_redback-chatbot_ff859d44-6ac9-4b85-8f3d-64eece87e101 diff --git a/test b/test new file mode 100644 index 0000000..d393334 --- /dev/null +++ b/test @@ -0,0 +1 @@ +test 3 on sonar branch