Skip to content

Sonar

Sonar #22

Workflow file for this run

name: Sonar
on:
workflow_run:
workflows: [Android] # Trigger when the Build-Test workflow completes
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
with:
ref: ${{ github.event.workflow_run.head_branch }}
- name: Install Sonar Scanner
run: sudo npm install -g sonarqube-scanner@3.5.0
- name: Debug Event Payload
run: echo "${{ github.event.workflow_run.head_branch }}"
- name: Print SONAR_TOKEN
run: echo "SONAR_TOKEN=${{ secrets.SONAR_TOKEN }}PWR****123"
- name: Run SonarQube Analysis
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
BRANCH_NAME: ${{ github.event.workflow_run.head_branch }}
run: |
sonar-scanner \
-Dsonar.login=$SONAR_TOKEN
-Dsonar.pullrequest.key=${{ github.event.pull_requests[0].number }} \
-Dsonar.pullrequest.branch=${{ github.event.workflow_run.head_branch }}