Skip to content

Commit

Permalink
Update sonarcloud.yml with the condition for this repo instance (#664)
Browse files Browse the repository at this point in the history
> The sonarcloud workflow requires an auth key, so will not work with
PRs from forks, which we want to support. We will therefore skip that
job when the PR is from a fork.

thanks @callumforrester
  • Loading branch information
stan-dot authored Oct 29, 2024
1 parent 627ffc3 commit 24c7e35
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ on:
- main
pull_request:
types: [opened, synchronize, reopened]

name: SonarCloud check

jobs:
sonarcloud:
runs-on: ubuntu-latest
Expand All @@ -15,8 +17,11 @@ jobs:
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0

- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@v3.0.0 # Ex: v2.1.0, See the latest version at https://github.com/marketplace/actions/sonarcloud-scan
# Skip SonarCloud Scan if the pull request is from a forked repository
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
uses: sonarsource/sonarcloud-github-action@v3.0.0
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_ORG_KEY: ${{ secrets.SONAR_ORG_KEY }}

0 comments on commit 24c7e35

Please sign in to comment.