Skip to content

Commit f2f0bd3

Browse files
committed
CI - move trigger signal to build job reducing duplication.
1 parent dfc5e70 commit f2f0bd3

File tree

1 file changed

+26
-22
lines changed

1 file changed

+26
-22
lines changed

.github/workflows/build.yml

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
strategy:
1717
matrix:
1818
os: [ubuntu-latest] #, macos-latest]
19+
outputs:
20+
trigger_signal: ${{ steps.trigger_signal.conclusion }}
1921
steps:
2022
- uses: actions/checkout@v2
2123

@@ -61,20 +63,32 @@ jobs:
6163
path: ${{ github.workspace }}/whalelint-${{ github.sha }}
6264
retention-days: 7
6365

66+
- name: Need to trigger workflows
67+
id: trigger_signal
68+
if: |
69+
(
70+
github.event_name == 'push' &&
71+
github.ref == 'refs/heads/main'
72+
) ||
73+
(
74+
github.event_name == 'pull_request' &&
75+
github.base_ref == 'main' &&
76+
github.event.pull_request.head.repo.full_name == github.repository &&
77+
!startsWith(github.actor, 'dependabot')
78+
)
79+
run: echo "Need to trigger further workflows"
80+
81+
debug:
82+
name: debug
83+
needs: build_and_test
84+
runs-on: ubuntu-latest
85+
steps:
86+
- run: echo ${{ needs.build_and_test.outputs.trigger_signal }}
87+
6488
vscode:
6589
name: vscode-trigger
6690
needs: build_and_test
67-
if: |
68-
(
69-
github.event_name == 'push' &&
70-
github.ref == 'refs/heads/main'
71-
) ||
72-
(
73-
github.event_name == 'pull_request' &&
74-
github.base_ref == 'main' &&
75-
github.event.pull_request.head.repo.full_name == github.repository &&
76-
!startsWith(github.actor, 'dependabot')
77-
)
91+
if: needs.build_and_test.outputs.trigger_signal == 'success'
7892
runs-on: ubuntu-latest
7993
steps:
8094
- name: Dump context
@@ -98,17 +112,7 @@ jobs:
98112
jetbrains:
99113
name: jetbrains-trigger
100114
needs: build_and_test
101-
if: |
102-
(
103-
github.event_name == 'push' &&
104-
github.ref == 'refs/heads/main'
105-
) ||
106-
(
107-
github.event_name == 'pull_request' &&
108-
github.base_ref == 'main' &&
109-
github.event.pull_request.head.repo.full_name == github.repository &&
110-
!startsWith(github.actor, 'dependabot')
111-
)
115+
if: needs.build_and_test.outputs.trigger_signal == 'success'
112116
runs-on: ubuntu-latest
113117
steps:
114118
- name: Trigger JetBrains plugin build workflow

0 commit comments

Comments
 (0)