Skip to content

[GHA] Do not run sonarcloud on forks (#1222) #214

[GHA] Do not run sonarcloud on forks (#1222)

[GHA] Do not run sonarcloud on forks (#1222) #214

Workflow file for this run

name: sonarcloud.io
on:
push:
branches:
- master
# Community version only allows running against 'main' branch, see https://docs.sonarsource.com/sonarqube/latest/devops-platform-integration/github-integration/
jobs:
build:
# Do not run sonar on forks because SONAR_TOKEN is available only for project owner
if: github.repository_owner == 'damianszczepanik'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: adopt
- name: Build with Maven
run: mvn --batch-mode package sonar:sonar -Dsonar.projectKey=damianszczepanik_cucumber-reporting -Dsonar.organization=damianszczepanik -Dsonar.host.url=https://sonarcloud.io -Dsonar.token=$SONAR_TOKEN
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}