Skip to content
This repository was archived by the owner on Sep 1, 2022. It is now read-only.

Commit d1ba8ec

Browse files
authored
Merge pull request #96 from githubtraining/fix-release-drafter-config
WIP: Fix release drafter config step
2 parents 84b9ec0 + e818790 commit d1ba8ec

File tree

8 files changed

+97
-28
lines changed

8 files changed

+97
-28
lines changed

config.yml

Lines changed: 69 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@ before:
1818
data:
1919
releases: '%payload.repository.html_url%/releases'
2020

21+
# Repo artifacts:
22+
# 1. Issue: Welcome
23+
# 2. Issue: Organizing a release
24+
# 3. Issue: Adding a feature
25+
# 4. PR: [title created by learner] — adding a feature PR
26+
# 5. Issue: Create a release pull request
27+
# 6. PR: [title created by learner] — release PR
28+
# 7. PR: More features for next release
29+
# 8. PR: [title created by learner] — release drafter PR
30+
# 9. Issue: Finalize the release
31+
# 10. PR: Accidental bugs
32+
# 11. PR: Backport the hotfix
33+
# 12. Issue: Create a patch release
34+
2135
steps:
2236

2337
#1 - ask the user to create a beta release from the most recent commit on master
@@ -94,6 +108,7 @@ steps:
94108
- type: respond
95109
with: 05.1_wrong-base.md
96110
issue: '%payload.pull_request.number%'
111+
# TODO: reduce possible extra PRs by allowing learner to change the base instead of closing PR
97112
# and we close the pull request, unmerged
98113
- type: closeIssue
99114
issue: '%payload.pull_request.number%'
@@ -161,6 +176,7 @@ steps:
161176
- type: closeIssue
162177
# If they did everything right, we create a new pull request going into the release branch.
163178
# Currently the change is very minor, but it should make sense with the release.
179+
# TODO: remove addition of release drafter config from `green-colors` PR, this is added at a later point
164180
- type: createPullRequest
165181
title: More features for the next release
166182
body: 07.1_new-pr.md
@@ -191,6 +207,8 @@ steps:
191207
- type: respond
192208
with: 08.2_github-app.md
193209
issue: 6
210+
data:
211+
prUrl: '%payload.repository.html_url%/compare/release-v1.0...config-release-drafter?expand=1'
194212
- type: respond
195213
with: 08.1_back-to-release.md
196214
data:
@@ -199,9 +217,30 @@ steps:
199217
#8 - Install the GitHub app and then populate the release-drafter.yml file
200218
- title: GitHub app and configuration template
201219
description: Install the GitHub app to help with release notes, then populate the `release-drafter.yml` file
202-
event: pull_request.synchronize
220+
event: pull_request
203221
link: '{{ repoUrl }}/pull/6'
204222
actions:
223+
# We check that the pull request has the correct "base" and "compare"
224+
- type: gate
225+
gates:
226+
- left: '%payload.action%'
227+
operator: ===
228+
right: edited
229+
- left: '%payload.action%'
230+
operator: ===
231+
right: opened
232+
- type: gate
233+
gates:
234+
- left: '%payload.pull_request.base.ref%'
235+
operator: ===
236+
right: release-v1.0
237+
- left: '%payload.pull_request.head.ref%'
238+
operator: ===
239+
right: config-release-drafter
240+
every: true
241+
else:
242+
- type: respond
243+
with: 08.4_wrong-base.md
205244
- type: octokit
206245
method: pullRequests.getFiles
207246
owner: '%payload.repository.owner.login%'
@@ -215,11 +254,27 @@ steps:
215254
else:
216255
- type: respond
217256
with: 08.3_config-validation.md
257+
- type: createReview
258+
body: 08.5_merge-the-config.md
259+
event: APPROVE
260+
261+
#9 - Merge the release drafter configuration
262+
- title: Merge the config for release drafter
263+
description: Merge the configuration file for release drafter, which sets a template for the release.
264+
event: pull_request.closed
265+
link: '{{ repoUrl }}/pull/8'
266+
actions:
267+
- type: respond
268+
with: 09.2_goto-release.md
269+
data:
270+
url: '6'
218271
- type: createReview
219272
body: 09.1_response.md
220273
event: APPROVE
274+
number: 6
275+
221276

222-
#9 - The user approves the branch merge into master
277+
#10 - The user approves the branch merge into master
223278
- title: Merge in the release
224279
description: Merge the release branch into master.
225280
event: pull_request.closed
@@ -253,11 +308,11 @@ steps:
253308
data:
254309
url: '%actions.finalIssue.data.html_url%'
255310

256-
#10 - User creates a release from the draft
311+
#11 - User creates a release from the draft
257312
- title: Finalize the release
258313
description: Complete the release by publishing the drafted release
259314
event: release.published
260-
link: '{{ repoUrl }}/issues/8'
315+
link: '{{ repoUrl }}/issues/9'
261316
actions:
262317
## Create a new PR for the hotfix
263318
- type: createPullRequest
@@ -273,6 +328,7 @@ steps:
273328
number: '%actions.newPullRequest.data.number%'
274329
assignees: '%payload.repository.owner.login%'
275330
## Suggest a change in the new PR
331+
# TODO: request a review from the learner
276332
- type: octokit
277333
method: pullRequests.createComment
278334
owner: '%payload.repository.owner.login%'
@@ -281,13 +337,11 @@ steps:
281337
commit_id: '%actions.newPullRequest.data.head.sha%'
282338
path: game.js
283339
body: |
340+
How's this change?
341+
284342
```suggestion
285343
starCtx.fillStyle = "#000";
286344
```
287-
### :keyboard: Activity: Apply the suggestion
288-
1. Click **Commit suggestion**
289-
2. Enter a commit message
290-
3. Click **Commit changes**
291345
For more information about suggest changes, check out this [GitHub Help](https://help.github.com/articles/incorporating-feedback-in-your-pull-request) article.
292346
position: 5
293347
- type: respond
@@ -298,14 +352,14 @@ steps:
298352
- type: closeIssue
299353
issue: Finalize the release
300354

301-
302-
#11 - User resolves the bug, then approves the pull request and it is merged into master
355+
#12 - User resolves the bug, then approves the pull request and it is merged into master
303356
- title: Submit a hotfix
304357
description: Resolve the bug, then merge the fix into the master branch
305358
event: pull_request_review.submitted
306-
link: '{{ repoUrl }}/pull/9'
359+
link: '{{ repoUrl }}/pull/10'
307360
actions:
308361
- type: mergePullRequest
362+
# TODO: request a review from the learner
309363
- type: createPullRequest
310364
title: Backport the hotfix
311365
body: 13.2_backport.md
@@ -317,11 +371,11 @@ steps:
317371
data:
318372
url: '%actions.backportPR.data.html_url%'
319373

320-
#12 - Hotfix is reverse merged into the release branch
374+
#13 - Hotfix is reverse merged into the release branch
321375
- title: Backport the hotfix
322376
description: Apply the patch commits to the release branch
323377
event: pull_request_review.submitted
324-
link: '{{ repoUrl }}/pull/10'
378+
link: '{{ repoUrl }}/pull/11'
325379
actions:
326380
- type: mergePullRequest
327381
- type: createIssue
@@ -335,11 +389,11 @@ steps:
335389
data:
336390
url: '%actions.patchIssue.data.html_url%'
337391

338-
#13 - Backport the hotfix into existing release
392+
#14 - Backport the hotfix into existing release
339393
- title: Release v1.0.1
340394
description: Create a release based on the most recent commit on the release branch
341395
event: release.published
342-
link: '{{ repoUrl }}/issues/11'
396+
link: '{{ repoUrl }}/issues/12'
343397
actions:
344398
- type: createIssue
345399
title: Congratulations

responses/08.2_github-app.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,16 @@ First, let's make sure that we're set up to document the version changes for the
88

99
We'll be using the Release Drafter GitHub app to draft our release notes as pull requests are merged.
1010

11-
The Release Drafter updates releases, so it requires write access to this repository. When you install the app, **don't add it to your entire GitHub account. Only install it on this repository.** [Release Drafter](https://github.com/apps/release-drafter) doesn't work just out of the box. If you use this in the future, you'll need to add `.github/release-drafter.yml` to your repository. (This is already done in this repository.)
11+
The Release Drafter updates releases, so it requires write access to this repository. When you install the app, you **don't need to add it to your entire GitHub account. Only install it on this repository.** [Release Drafter](https://github.com/apps/release-drafter) doesn't work just out of the box. If you use this in the future, you'll need to add `.github/release-drafter.yml` to your repository. We'll take care of adding this in a separate PR.
1212

1313
### :keyboard: Activity: Install the Release Drafter GitHub app
1414

1515
1. Install the <a href="https://probot.github.io/apps/release-drafter/" target="_blank">Release Drafter GitHub app</a> to this repository **only**.
16-
1. Create a new file in the `.github` folder named `release-drafter.yml` on this branch.
17-
1. Add the following code to your new file:
18-
19-
```
20-
template: |
21-
## What's Changed
22-
23-
$CHANGES
24-
```
16+
1. Open a [new pull request]({{ prUrl }}) with `base: release-v1.0` and `compare: config-release-drafter`. This will add the configuration file for Release Drafter to this repository.
2517

2618
Note: For privacy reasons, we can't see what other apps have access to this repository, so we'll take your word for it.
2719

2820
<hr>
29-
<h3 align="center">After installing the app, assign yourself to this issue and look for my response below</h3>
21+
<h3 align="center">I'll respond in your new pull request.</h3>
3022

3123
> _Sometimes I respond too fast for the page to update! If you don't see a response from me, wait a few seconds and refresh the page for your next steps._

responses/08.4_wrong-base.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Uh oh, the base of this pull request isn't quite right.
2+
3+
### :keyboard: Activity: Fix the base
4+
5+
See [Changing the base branch of a pull request](https://help.github.com/articles/changing-the-base-branch-of-a-pull-request/) for full instructions.
6+
7+
<hr>
8+
<h3 align="center">I'll respond in this pull request when you've changed the base.</h3>

responses/08.5_merge-the-config.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### :keyboard: Activity: Merge the pull request
2+
3+
1. Click **Merge pull request**, and delete your branch.

responses/09.2_goto-release.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Nice work. Your next steps are back in the [release's pull request]({{ url }}).

responses/11.1_hotfix-intro.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@ We've already created this branch, pull request, and suggested a fix. The sugges
1212

1313
## Step 12: Fixing the bug
1414

15-
Apply the suggested change by following the instructions below.
15+
Apply the suggested change as follows.
16+
17+
### :keyboard: Activity: Apply the suggestion
18+
1. Click **Commit suggestion**
19+
2. Enter a commit message
20+
3. Click **Commit changes**
21+
4. Approve this pull request.
22+
1623

1724
<hr>
1825
<h3 align="center">I'll respond below with your next steps</h3>

responses/11.2_next-bug.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Thanks for applying that suggestion! Now that the bug has been fixed, **approve this pull request** and then navigate to [the next pull request]({{ url }}) for your next steps.
1+
Congratulations on creating Release v1.0.0! Navigate to [the next pull request]({{ url }}) for your next steps.

responses/suggest-changes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
### :keyboard: Activity: Apply the suggestion
2+
1. Click **Commit suggestion**
3+
2. Enter a commit message
4+
3. Click **Commit changes**

0 commit comments

Comments
 (0)