Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

Sonar

Sonar #10

Workflow file for this run

---
name: Sonar
on:
workflow_run:
workflows: [Unit tests]
types: [completed]
jobs:
sonar:
name: Sonar
runs-on: ubuntu-latest
container:
image: fedora:38
if: github.event.workflow_run.conclusion == 'success'
steps:
- name: echo event
run: cat $GITHUB_EVENT_PATH
- name: Mask secrets
shell: bash
run: |
echo "::add-mask::${{ secrets.GITHUB_TOKEN }}"
echo "::add-mask::${{ secrets.SONAR_TOKEN }}"
- name: Download PR number artifact
uses: dawidd6/action-download-artifact@v3
with:
workflow: unit_tests.yml
run_id: ${{ github.event.workflow_run.id }}
name: pr_number
- name: Read PR_NUMBER.txt
id: pr_number
uses: juliangruber/read-file-action@v1
with:
path: ./PR_NUMBER.txt
- name: Install dependencies
shell: bash
run: dnf --setopt install_weak_deps=False install -y gettext git-core unzip
- name: Request GitHub API for PR data
uses: octokit/[email protected]
id: get_pr_data
with:
route: GET /repos/{full_name}/pulls/{number}
number: ${{ steps.pr_number.outputs.content }}
full_name: ${{ github.event.repository.full_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
with:
repository: ${{ github.event.workflow_run.head_repository.full_name }}
ref: ${{ github.event.workflow_run.head_branch }}
fetch-depth: 0
- name: Checkout base branch
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
git remote add upstream ${{ github.event.repository.clone_url }}
git fetch upstream
git checkout -B ${{ fromJson(steps.get_pr_data.outputs.data).base.ref }} upstream/${{ fromJson(steps.get_pr_data.outputs.data).base.ref }}
git checkout ${{ github.event.workflow_run.head_branch }}
git clean -ffdx && git reset --hard HEAD
- name: Set Environment Variables
uses: ./.github/actions/set_vars
with:
varFilePath: ./.github/variables/pr_verification.env
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
- name: Download unit test report
uses: dawidd6/action-download-artifact@v3
with:
workflow: unit_tests.yml
run_id: ${{ github.event.workflow_run.id }}
name: unit_test_reports
- name: Analyze
if: ${{ fromJson(steps.get_pr_data.outputs.data).base.ref == 'main' || fromJson(steps.get_pr_data.outputs.data).base.ref.startswith('test')}}

Check failure on line 87 in .github/workflows/sonar.yml

View workflow run for this annotation

GitHub Actions / Sonar

Invalid workflow file

The workflow is not valid. .github/workflows/sonar.yml (Line: 87, Col: 13): Unexpected symbol: '('. Located at position 124 within expression: fromJson(steps.get_pr_data.outputs.data).base.ref == 'main' || fromJson(steps.get_pr_data.outputs.data).base.ref.startswith('test')
uses: gradle/gradle-build-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
arguments: sonar -x coverage
-Dsonar.scm.provider=git
-Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }}
-Dsonar.pullrequest.key=${{ fromJson(steps.get_pr_data.outputs.data).number }}
-Dsonar.pullrequest.base=${{ fromJson(steps.get_pr_data.outputs.data).base.ref }}
-Dsonar.pullrequest.branch=${{ fromJson(steps.get_pr_data.outputs.data).head.ref }}
-Dorg.gradle.jvmargs=-Xmx1g