A Github Action for wrapping SonarSource/sonarcloud-github-action with all the boilerplate necessary to do the right thing for pull requests from forks in workflow runs.
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Michael Telatynski c5aebf7c1d
Add caution note regarding project archiving
Added caution note about the archiving of the project due to security concerns with Sonarcloud.
2026-07-23 14:53:29 +01:00
.github Rename renovate.json to .github/renovate.json 2023-11-09 08:58:25 +00:00
action.yml Update SonarSource/sonarqube-scan-action digest to 7138816 2026-06-09 11:03:07 +00:00
LICENSE Initial commit 2022-05-31 14:45:31 +01:00
README.md Add caution note regarding project archiving 2026-07-23 14:53:29 +01:00

Caution

This is archived as there is foolproof way to run Sonarcloud against attacker-controlled PRs.

sonarcloud-workflow-action

A Github Action for wrapping SonarSource/sonarcloud-github-action with all the boilerplate necessary to do the right thing for pull requests from forks in workflow runs.

Example for running from a workflow_run workflow.

name: SonarQube
on:
  workflow_run:
    workflows: [ "Tests" ]
    types:
      - completed
concurrency:
  group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch }}
  cancel-in-progress: true
jobs:
  sonarqube:
    name: SonarQube
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          repository: ${{ github.event.workflow_run.head_repository.full_name }}
          ref: ${{ github.event.workflow_run.head_branch }} # checkout commit that triggered this workflow
          fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
      - uses: matrix-org/setup-python-poetry@v1.2.2
      - name: SonarCloud Scan
        uses: matrix-org/sonarcloud-workflow-action@v3.2
        with:
          skip_checkout: true
          is_pr: ${{ github.event.workflow_run.event == 'pull_request' }}
          repository: ${{ github.event.workflow_run.head_repository.full_name }}
          version_cmd: "poetry version --short"
          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: tests.yml