This repository has been archived by the owner on Sep 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
/
config.yml
188 lines (179 loc) · 5.87 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
title: 'GitHub Actions: Hello World'
description: Create a GitHub Action and use it in a workflow.
tags:
- GitHub Actions
- Workflows
- Hello World
template:
name: hello-github-actions
repo: hello-github-actions-template
before:
# protect the main branch
- type: updateBranchProtection
# open issue 1 (welcome)
- type: createIssue
title: Welcome
body: 00.0_welcome.md
comments:
- 00.1_first-steps.md
data:
dockerfileUrl: "%payload.repository.html_url%/new/main?filename=action-a/Dockerfile"
# Repo artifacts:
# Issue 1: Welcome
# PR 2: (created by learner) houses the addition of the Dockerfile, entrypoint script, and workflow
# Issue 3: Congratulations
steps:
# 1 - Add a Dockerfile
- title: Add a Dockerfile
description: Start your action by creating a Dockerfile
event: pull_request
link: "{{ repoUrl }}/issues/1"
actions:
- type: gate
gates:
- left: "%payload.action%"
operator: ===
right: opened
- left: "%payload.action%"
operator: ===
right: synchronize
- type: getTree
action_id: tree
recursive: true
sha: "%payload.pull_request.head.sha%"
- type: gate
left: "%actions.tree.data.tree%"
operator: includes
right: path:action-a/Dockerfile
else:
type: respond
with: 01.1_e-no-docker.md
- type: respond
with: 01.0_docker-success.md
data:
actionAUrl: "%payload.repository.html_url%/new/%payload.pull_request.head.ref%?filename=action-a/entrypoint.sh"
- type: closeIssue
issue: Welcome
# 2 - Add an entrypoint script
- title: Add an entrypoint script
description: Script out how your action will run with an entrypoint script
event: pull_request.synchronize
link: "{{ repoUrl }}/pull/2"
actions:
- type: getTree
action_id: tree
recursive: true
sha: "%payload.pull_request.head.sha%"
- type: gate
left: "%actions.tree.data.tree%"
operator: includes
right: path:action-a/entrypoint.sh
else:
type: respond
with: 02.1_e-no-entrypoint.md
- type: respond
with: 02.0_entrypoint-success.md
data:
actionAUrl: "%payload.repository.html_url%/new/%payload.pull_request.head.ref%?filename=action-a/action.yml"
# 3 - Add action metadata
- title: Add an action.yml file
description: Create the necessary metadata for the action
event: pull_request.synchronize
link: "{{ repoUrl }}/pull/2"
actions:
- type: getTree
action_id: tree
recursive: true
sha: "%payload.pull_request.head.sha%"
- type: gate
left: "%actions.tree.data.tree%"
operator: includes
right: path:action-a/action.yml
else:
type: respond
with: 03.1_e-no-actionyml.md
- type: respond
with: 03.0_actionyml-success.md
data:
worfkflowUrl: "%payload.repository.html_url%/new/%payload.pull_request.head.ref%?filename=.github/workflows/main.yml"
# 4 - Start your workflow file
- title: Start your workflow file
description: Get your workflow kicked off with the workflow file
event: pull_request.synchronize
link: "{{ repoUrl }}/pull/2"
actions:
- type: getTree
action_id: tree
recursive: true
sha: "%payload.pull_request.head.sha%"
- type: gate
left: "%actions.tree.data.tree%"
operator: includes
right: path:/^.github/workflows/main.yml$/
else:
type: respond
with: 04.1_e-no-workflow.md
- type: respond
with: 04.0_workflow-block-success.md
data:
workflowEditUrl: "%payload.repository.html_url%/edit/%payload.pull_request.head.ref%/.github/workflows/main.yml?pr=/%payload.repository.full_name%/pull/%payload.number%"
# 5 - Run an action from your workflow file
- title: Run an action from your workflow file
description: Specify a job and call actions within your workflow file
event: pull_request.synchronize
link: "{{ repoUrl }}/pull/2"
actions:
- type: getTree
action_id: tree
recursive: true
sha: "%payload.pull_request.head.sha%"
- type: gate
left: "%actions.tree.data.tree%"
operator: includes
right: path:/^.github/workflows/main.yml$/
else:
type: respond
with: 04.1_e-no-workflow.md
- type: respond
with: 05.0_trigger.md
# 6 - Trigger the workflow
- title: Trigger the workflow
description: See your push trigger the workflow you've created and run your action
event: check_run.completed
link: "{{ repoUrl }}/pull/2"
actions:
- type: gate
left: "%payload.check_run.conclusion%"
operator: ===
right: success
else:
- type: respond
issue: "%payload.check_run.pull_requests.0.number%"
with: 06.1_e-no-run.md
data:
repo: "%payload.repository.html_url%"
- type: createReview
pullRequest: "%payload.check_run.pull_requests.0.number%"
body: 06.0_workflow-success.md
event: APPROVE
data:
repo: "%payload.repository.html_url%"
- type: removeBranchProtection
# 7 - Incorporate the action
- title: Incorporate the workflow
description: Merge your branch for the workflow to become incorporated
event: pull_request.closed
link: "{{ repoUrl }}/pull/2"
actions:
- type: gate
left: "%payload.pull_request.merged%"
- type: createIssue
title: Congratulations
body: 07.0_workflow-finished.md
data:
repo: "%payload.repository.html_url%"
action_id: congratsIssue
- type: respond
with: 07.1_go-to-final.md
data:
url: "%actions.congratsIssue.data.html_url%"