Skip to content

sonar

sonar #7

Workflow file for this run

name: sonar
on:
workflow_run:
workflows: [build]
types: [completed]
jobs:
sonar-cloud:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.workflow_run.head_repository.full_name }}
ref: ${{ github.event.workflow_run.head_branch }}
fetch-depth: 0
- name: Download code coverage
uses: dawidd6/action-download-artifact@v2
with:
workflow: build.yml
commit: ${{ github.event.workflow_run.head_sha }}
name: report-output
path: build/reports
- name: Setup java
uses: actions/setup-java@v3
with:
distribution: ${{ vars.JAVA_VENDOR }}
java-version: ${{ vars.JAVA_VERSION }}
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: wrapper
- name: SonarCloud analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
./gradlew sonar --info \
-Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }} \
-Dsonar.pullrequest.key=${{ github.event.workflow_run.pull_requests[0].number }} \
-Dsonar.pullrequest.branch=${{ github.event.workflow_run.pull_requests[0].head.ref }} \
-Dsonar.pullrequest.base=${{ github.event.workflow_run.pull_requests[0].base.ref }} \