Skip to content

Commit 11135af

Browse files
authored
Merge pull request #552 from com-pas/fix/run-sonarcloud-analysis-on-dependabot-prs
chore: enable SonarCloud analysis for Dependabot pr's
2 parents 18ea09c + 7dba7f7 commit 11135af

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

.github/workflows/sonarcloud-analysis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@ jobs:
1818
- name: echo event
1919
run: cat $GITHUB_EVENT_PATH
2020
- name: Download PR number artifact
21-
if: github.event.workflow_run.event == 'pull_request'
21+
if: github.event.workflow_run.event == 'pull_request' || (github.event.workflow_run.actor == 'dependabot[bot]' && github.event.workflow_run.event == 'pull_request_target')
2222
uses: dawidd6/action-download-artifact@v11
2323
with:
2424
workflow: SonarCloud Build
2525
run_id: ${{ github.event.workflow_run.id }}
2626
name: PR_NUMBER
2727
- name: Read PR_NUMBER.txt
28-
if: github.event.workflow_run.event == 'pull_request'
28+
if: github.event.workflow_run.event == 'pull_request' || (github.event.workflow_run.actor == 'dependabot[bot]' && github.event.workflow_run.event == 'pull_request_target')
2929
id: pr_number
3030
uses: juliangruber/read-file-action@v1
3131
with:
3232
path: ./PR_NUMBER.txt
3333
- name: Request GitHub API for PR data
34-
if: github.event.workflow_run.event == 'pull_request'
34+
if: github.event.workflow_run.event == 'pull_request' || (github.event.workflow_run.actor == 'dependabot[bot]' && github.event.workflow_run.event == 'pull_request_target')
3535
uses: octokit/[email protected]
3636
id: get_pr_data
3737
with:
@@ -46,7 +46,7 @@ jobs:
4646
ref: ${{ github.event.workflow_run.head_branch }}
4747
fetch-depth: 0
4848
- name: Checkout base branch
49-
if: github.event.workflow_run.event == 'pull_request'
49+
if: github.event.workflow_run.event == 'pull_request' || (github.event.workflow_run.actor == 'dependabot[bot]' && github.event.workflow_run.event == 'pull_request_target')
5050
run: |
5151
git remote add upstream ${{ github.event.repository.clone_url }}
5252
git fetch upstream

.github/workflows/sonarcloud-build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ jobs:
6767
run: |
6868
./mvnw -B -s custom_maven_settings.xml clean verify
6969
- name: Save PR number to file
70-
if: github.event_name == 'pull_request'
71-
run: echo ${{ github.event.number }} > PR_NUMBER.txt
70+
if: ${{ github.event_name == 'pull_request' || (github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target') }}
71+
run: echo ${{ github.event.pull_request.number }} > PR_NUMBER.txt
7272
- name: Archive PR number
73-
if: github.event_name == 'pull_request'
73+
if: ${{ github.event_name == 'pull_request' || (github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target') }}
7474
uses: actions/upload-artifact@v5
7575
with:
7676
name: PR_NUMBER

0 commit comments

Comments
 (0)