Skip to content

Commit 47d41f5

Browse files
itsyoboieltrlegobeat
authored andcommitted
feat: workflow_run
1 parent f9ec0e0 commit 47d41f5

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,12 @@ jobs:
3232
name: Run tests
3333
uses: ./.github/workflows/run-tests.yml
3434

35-
sonarcloud:
36-
name: SonarCloud
37-
uses: ./.github/workflows/sonarcloud.yml
38-
secrets:
39-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
40-
needs:
41-
- run-tests
42-
4335
all-jobs-completed:
4436
name: All jobs completed
4537
runs-on: ubuntu-latest
4638
needs:
4739
- check-workflows
4840
- run-tests
49-
- sonarcloud
5041
outputs:
5142
PASSED: ${{ steps.set-output.outputs.PASSED }}
5243
steps:

.github/workflows/sonarcloud.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
name: SonarCloud
22

33
on:
4-
workflow_call:
5-
secrets:
6-
SONAR_TOKEN:
7-
required: true
4+
workflow_run:
5+
workflows:
6+
- Run tests
7+
types:
8+
- completed
89

910
jobs:
1011
sonarcloud:
12+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1113
name: SonarCloud
1214
runs-on: ubuntu-latest
1315
steps:
1416
- name: Checkout repository
1517
uses: actions/checkout@v4
1618
with:
19+
repository: ${{ github.event.workflow_run.head_repository.full_name }} # Use the repository that triggered the workflow
20+
ref: ${{ github.event.workflow_run.head_branch }} # Use the branch that triggered the workflow
1721
fetch-depth: 0 # Shallow clones should be disabled for better relevancy of analysis
1822

1923
- name: Download artifacts

0 commit comments

Comments
 (0)