diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml new file mode 100644 index 0000000..2f56fd2 --- /dev/null +++ b/.github/workflows/sonar.yml @@ -0,0 +1,35 @@ +# SonarCloud analysis for the community-health repository. +# +# Explicit rather than automatic. This repo holds no application source, so +# SonarCloud's automatic analysis finds no language it recognises and reports +# nothing — the project sits empty and the badge never resolves. A scan told +# where to look via sonar-project.properties produces a real result for the +# markdown and workflow files that are the substance here. +# +# The sibling repositories keep automatic analysis; only this one needs the +# workflow, because only this one has nothing for the detector to find. +name: sonar + +on: + push: + branches: [main] + pull_request: + +permissions: + contents: read + +jobs: + sonar: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + # Sonar attributes new code to the commits that introduced it, and a + # shallow clone leaves it guessing. + fetch-depth: 0 + + - name: SonarCloud scan + uses: SonarSource/sonarqube-scan-action@22918119ff8e1ca75a623e15c8296b6ea4fbe28f # v8.2.1 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..19aee6e --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,15 @@ +sonar.projectKey=beatrax-app_.github +sonar.organization=beatrax + +# A configuration repository: community-health files, issue templates and the +# workflows that carry them. There is no application source, so the scan has to +# be told what to look at — automatic analysis finds no recognised language here +# and reports nothing at all. +sonar.sources=. +sonar.exclusions=**/*.png,**/*.svg,.github/ISSUE_TEMPLATE/** + +# No test tree. Declared empty rather than left unset so the scanner does not +# infer one and then report zero coverage against files that have no tests by +# design. +sonar.tests= +sonar.sourceEncoding=UTF-8