Skip to content

Commit e2dfc7e

Browse files
committed
Incorporate intermediate "trigger named" workflows as workflow_run can only trigger on the workflow name
1 parent eb9a804 commit e2dfc7e

File tree

8 files changed

+140
-18
lines changed

8 files changed

+140
-18
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Trigger - Test extra build
3+
4+
on:
5+
workflow_call:
6+
7+
permissions:
8+
contents: read
9+
packages: read
10+
# To report GitHub Actions status checks
11+
statuses: write
12+
13+
jobs:
14+
extra:
15+
runs-on: ubuntu-latest
16+
steps:
17+
# No-op job to trigger workflow 'extra.yml' via workflow_run
18+
- uses: jakejarvis/wait-action@master
19+
with:
20+
time: '1s'

.github/workflows/extra.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
name: Test extra build
88
on:
99
workflow_dispatch:
10+
#workflow_run:
11+
# workflows: ["Trigger - Test extra build"]
12+
# types: [completed,requested]
1013
workflow_run:
11-
workflows: ["extra"]
12-
types:
13-
- completed
14+
workflows: ["Test on push and pull request"]
15+
#types: [completed,requested]
16+
types: [completed]
1417

1518
permissions:
1619
contents: read
@@ -19,6 +22,12 @@ permissions:
1922
statuses: write
2023

2124
jobs:
25+
test:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- run: echo "event name is:" ${{ github.event_name }}
29+
- run: echo "event type is:" ${{ github.event.action }}
30+
2231
doca:
2332
name: extra-build
2433
runs-on: ubuntu-22.04

.github/workflows/main.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,29 +127,38 @@ jobs:
127127
needs: files_changed
128128
if: |
129129
needs.files_changed.outputs.stackhpc == 'true'
130-
runs-on: ubuntu-latest
130+
#uses: ./.github/workflows/stackhpc-trigger.yml
131+
# TEST - remove from here and uncomment the above
131132
steps:
132-
# No-op job to trigger workflow 'stackhpc.yml' via workflow_run
133-
- uses: mattdesl/no-op@32ec85ff176f761f607087006bda993440da5fe4
133+
- uses: jakejarvis/wait-action@master
134+
with:
135+
time: '1s'
136+
runs-on: ubuntu-latest
134137

135138
extra:
136139
name: Test extra build
137140
needs: files_changed
138141
if: |
139142
github.event_name != 'pull_request' && needs.files_changed.outputs.extra_on_push == 'true' ||
140143
github.event_name == 'pull_request' && needs.files_changed.outputs.extra_on_pull_request == 'true'
141-
runs-on: ubuntu-latest
144+
#uses: ./.github/workflows/extra-trigger.yml
145+
# TEST - remove from here and uncomment the above
142146
steps:
143-
# No-op job to trigger workflow 'extra.yml' via workflow_run
144-
- uses: mattdesl/no-op@32ec85ff176f761f607087006bda993440da5fe4
147+
- uses: jakejarvis/wait-action@master
148+
with:
149+
time: '1s'
150+
runs-on: ubuntu-latest
145151

146152
trivyscan:
147153
name: Trivy scan image for vulnerabilities
148154
needs: files_changed
149155
if: |
150156
github.event_name == 'pull_request' &&
151157
needs.files_changed.outputs.trivyscan == 'true'
152-
runs-on: ubuntu-latest
158+
#uses: ./.github/workflows/trivyscan-trigger.yml
159+
# TEST - remove from here and uncomment the above
153160
steps:
154-
# No-op job to trigger workflow 'trivyscan.yml' via workflow_run
155-
- uses: mattdesl/no-op@32ec85ff176f761f607087006bda993440da5fe4
161+
- uses: jakejarvis/wait-action@master
162+
with:
163+
time: '1s'
164+
runs-on: ubuntu-latest
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Trigger - Test deployment and reimage on OpenStack
3+
4+
on:
5+
workflow_call:
6+
7+
permissions:
8+
contents: read
9+
packages: read
10+
# To report GitHub Actions status checks
11+
statuses: write
12+
13+
jobs:
14+
stackhpc:
15+
runs-on: ubuntu-latest
16+
steps:
17+
# No-op job to trigger workflow 'stackhpc.yml' via workflow_run
18+
- uses: jakejarvis/wait-action@master
19+
with:
20+
time: '1s'

.github/workflows/stackhpc.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
name: Test deployment and reimage on OpenStack
88
on:
99
workflow_dispatch:
10+
#workflow_run:
11+
# workflows: ["Trigger - Test deployment and reimage on OpenStack"]
12+
# types: [completed,requested]
1013
workflow_run:
11-
workflows: ["stackhpc"]
12-
types:
13-
- completed
14+
workflows: ["Test on push and pull request"]
15+
#types: [completed,requested]
16+
types: [completed]
1417

1518
permissions:
1619
contents: read
@@ -19,6 +22,12 @@ permissions:
1922
statuses: write
2023

2124
jobs:
25+
test:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- run: echo "event name is:" ${{ github.event_name }}
29+
- run: echo "event type is:" ${{ github.event.action }}
30+
2231
openstack:
2332
name: openstack-ci
2433
runs-on: ubuntu-22.04

.github/workflows/test.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: Test
3+
4+
# This is a test workflow to see if we can introduce a new workflow (outside of the default branch)
5+
# and have it trigger from the main CI.
6+
# If it triggers, what will github.event_name be set to?
7+
# Ideally we want to know whether we've triggered downstream from a push or a pull request.
8+
9+
on:
10+
workflow_call:
11+
workflow_run:
12+
workflows: ["Test on push and pull request"]
13+
types: [completed,requested]
14+
15+
permissions:
16+
contents: read
17+
packages: read
18+
# To report GitHub Actions status checks
19+
statuses: write
20+
21+
jobs:
22+
test:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- run: echo "event name is:" ${{ github.event_name }}
26+
- run: echo "event type is:" ${{ github.event.action }}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Trigger - Trivy scan image for vulnerabilities
3+
4+
on:
5+
workflow_call:
6+
7+
permissions:
8+
contents: read
9+
packages: read
10+
# To report GitHub Actions status checks
11+
statuses: write
12+
13+
jobs:
14+
trivyscan:
15+
runs-on: ubuntu-latest
16+
steps:
17+
# No-op job to trigger workflow 'trivyscan.yml' via workflow_run
18+
- uses: jakejarvis/wait-action@master
19+
with:
20+
time: '1s'

.github/workflows/trivyscan.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
name: Trivy scan image for vulnerabilities
88
on:
99
workflow_dispatch:
10+
#workflow_run:
11+
# workflows: ["Trigger - Trivy scan image for vulnerabilities"]
12+
# types: [completed,requested]
1013
workflow_run:
11-
workflows: ["trivyscan"]
12-
types:
13-
- completed
14+
workflows: ["Test on push and pull request"]
15+
#types: [completed,requested]
16+
types: [completed]
1417

1518
permissions:
1619
contents: read
@@ -19,6 +22,12 @@ permissions:
1922
statuses: write
2023

2124
jobs:
25+
test:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- run: echo "event name is:" ${{ github.event_name }}
29+
- run: echo "event type is:" ${{ github.event.action }}
30+
2231
scan:
2332
runs-on: ubuntu-latest
2433
strategy:

0 commit comments

Comments
 (0)