forked from NUWCDIVNPT/stig-manager
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhacement: skips sonarcloud actions when PR form fork (NUWCDIVNPT#1351)
- Loading branch information
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -191,18 +191,29 @@ jobs: | |
needs: test_api | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check if PR is from a fork | ||
id: check_fork | ||
run: | | ||
if [ "${{ github.event.pull_request.head.repo.fork }}" == "true" ]; then | ||
echo "This is a PR from a fork, skipping sonarcloud analysis." | ||
echo "SKIP_STEP=true" >> $GITHUB_ENV | ||
fi | ||
- name: Checkout repository | ||
if: env.SKIP_STEP != 'true' | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Important to fetch all history for accurate blame information | ||
- name: Download lcov artifact | ||
if: env.SKIP_STEP != 'true' | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: coverage-report | ||
- name: Move lcov.info to api/source | ||
if: env.SKIP_STEP != 'true' | ||
run: mv lcov.info ./api/source/ | ||
|
||
- name: Analyze API with SonarCloud | ||
if: env.SKIP_STEP != 'true' | ||
uses: SonarSource/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,12 +27,22 @@ jobs: | |
name: SonarCloud Analysis client | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check if PR is from a fork | ||
id: check_fork | ||
run: | | ||
if [ "${{ github.event.pull_request.head.repo.fork }}" == "true" ]; then | ||
echo "This is a PR from a fork, skipping sonarcloud analysis." | ||
echo "SKIP_STEP=true" >> $GITHUB_ENV | ||
fi | ||
#checkout the repo | ||
- name: Checkout repository | ||
if: env.SKIP_STEP != 'true' | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Important to fetch all history for accurate blame information | ||
|
||
- name: Analyze client with SonarCloud | ||
if: env.SKIP_STEP != 'true' | ||
uses: SonarSource/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information | ||
|