Skip to content

Sonar

Sonar #19

Workflow file for this run

name: Sonar
on:
workflow_run:
workflows: [Android] # Trigger when the Build-Test workflow completes
branches:
- 'master'
- 'release-**'
types:
- completed # Trigger on completion of the Build-Test workflow
jobs:
SonarScanner:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success' # Run job only if Build-Test workflow succeeded
steps:
# Checkout repository to ensure we have the latest code
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Sonar Scanner
run: sudo npm install -g sonarqube-scanner@3.5.0
- name: Print SONAR_TOKEN
run: echo "SONAR_TOKEN=${{ secrets.SONAR_TOKEN }}PWR****123-${{ github.event.pull_request.number }}-${{ github.head_ref }}"
- name: Run SonarQube Analysis
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
run: |
sonar-scanner \
-Dsonar.login=$SONAR_TOKEN
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }} \
-Dsonar.pullrequest.branch=${{ github.head_ref }}