Skip to content

Commit 9db6b6e

Browse files
authored
Make workflow runs wait for workflow runs (#661)
* Make workflow runs wait for workflow runs * Split out workflows to allow standardfiles to control markdown, yaml and delivery - Adds a "Final" workflow to set a known pass/failure hook - This allows us to have Terraform set the Final workflow as a required check Signed-off-by: Dan Webb <[email protected]>
1 parent a4b192b commit 9db6b6e

File tree

5 files changed

+64
-33
lines changed

5 files changed

+64
-33
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,13 @@
22
name: ci
33

44
'on':
5-
pull_request:
6-
push:
7-
branches:
8-
- main
5+
workflow_run:
6+
workflows: ['Lint & Unit Test']
7+
types: [completed]
98

109
jobs:
11-
delivery:
12-
runs-on: ubuntu-latest
13-
steps:
14-
- name: Check out code
15-
uses: actions/checkout@v2
16-
- name: Run Chef Delivery
17-
uses: actionshub/chef-delivery@main
18-
env:
19-
CHEF_LICENSE: accept-no-persist
20-
21-
yamllint:
22-
runs-on: ubuntu-latest
23-
steps:
24-
- name: Check out code
25-
uses: actions/checkout@v2
26-
- name: Run yaml Lint
27-
uses: actionshub/yamllint@main
28-
29-
mdl:
30-
runs-on: ubuntu-latest
31-
steps:
32-
- name: Check out code
33-
uses: actions/checkout@v2
34-
- name: Run Markdown Lint
35-
uses: actionshub/markdownlint@main
36-
3710
integration:
38-
needs: [mdl, yamllint, delivery]
11+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
3912
runs-on: ubuntu-latest
4013
strategy:
4114
matrix:
@@ -92,7 +65,7 @@ jobs:
9265
os: ${{ matrix.os }}
9366

9467
integration-macos:
95-
needs: [mdl, yamllint, delivery]
68+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
9669
runs-on: macos-latest
9770
steps:
9871
- name: Check out code

.github/workflows/delivery.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: 'Lint & Unit Test'
3+
4+
'on':
5+
pull_request:
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
delivery:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check out code
14+
uses: actions/checkout@v2
15+
- name: Run Chef Delivery
16+
uses: actionshub/chef-delivery@main
17+
env:
18+
CHEF_LICENSE: accept-no-persist
19+
20+
yamllint:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Check out code
24+
uses: actions/checkout@v2
25+
- name: Run yaml Lint
26+
uses: actionshub/yamllint@main
27+
28+
mdl:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Check out code
32+
uses: actions/checkout@v2
33+
- name: Run Markdown Lint
34+
uses: actionshub/markdownlint@main

.github/workflows/final.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: 'Final'
3+
4+
'on':
5+
workflow_run:
6+
workflows: [ci]
7+
types: [completed]
8+
9+
jobs:
10+
on-success:
11+
runs-on: ubuntu-latest
12+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
13+
steps:
14+
- run: exit 0
15+
16+
on-failure:
17+
runs-on: ubuntu-latest
18+
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
19+
steps:
20+
- run: exit 1

.github/workflows/md-links.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: md-links
2+
name: 'Markdown Link Check'
33

44
"on":
55
pull_request:

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ This file is used to list changes made in each version of the Java cookbook.
44

55
## Unreleased
66

7+
- Split out workflows to allow standardfiles to control markdown, yaml and delivery
8+
- Adds a "Final" workflow to set a known pass/failure hook
9+
- This allows us to have Terraform set the Final workflow as a required check
10+
711
## 10.0.0 - *2021-09-02*
812

913
- Remove recipes to stop confusing users

0 commit comments

Comments
 (0)