SonarQube #112
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: SonarQube | |
on: | |
workflow_run: | |
workflows: | |
- React build | |
types: | |
- completed | |
concurrency: | |
group: ${{ github.ref == 'refs/heads/main' && format('sonarqube-main-{0}', github.sha) || format('sonarqube-pr-{0}', github.ref) }} | |
cancel-in-progress: true | |
jobs: | |
sonarqube: | |
name: 🩻 SonarQube | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
# We create the status here and then update it to success/failure in the `report` stage | |
# This provides an easy link to this workflow_run from the PR before Cypress is done. | |
- uses: Sibz/github-status-action@v1 | |
with: | |
authToken: ${{ secrets.GITHUB_TOKEN }} | |
state: pending | |
context: ${{ github.workflow }} / SonarCloud (${{ github.event.workflow_run.event }} => ${{ github.event_name }}) | |
sha: ${{ github.event.workflow_run.head_sha }} | |
target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
- name: "🩻 SonarCloud Scan" | |
id: sonarcloud | |
uses: matrix-org/sonarcloud-workflow-action@v3.2 | |
with: | |
repository: ${{ github.event.workflow_run.head_repository.full_name }} | |
is_pr: ${{ github.event.workflow_run.event == 'pull_request' }} | |
version_cmd: 'cat platforms/web/package.json | jq -r .version' | |
branch: ${{ github.event.workflow_run.head_branch }} | |
revision: ${{ github.event.workflow_run.head_sha }} | |
token: ${{ secrets.SONAR_TOKEN }} | |
coverage_run_id: ${{ github.event.workflow_run.id }} | |
coverage_workflow_name: react-build.yml | |
coverage_extract_path: coverage | |
- uses: Sibz/github-status-action@v1 | |
if: always() | |
with: | |
authToken: ${{ secrets.GITHUB_TOKEN }} | |
state: ${{ steps.sonarcloud.outcome == 'success' && 'success' || 'failure' }} | |
context: ${{ github.workflow }} / SonarCloud (${{ github.event.workflow_run.event }} => ${{ github.event_name }}) | |
sha: ${{ github.event.workflow_run.head_sha }} | |
target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} |