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

Commit c64eee4

Browse files
committed
adding more content
1 parent a0fcfe2 commit c64eee4

File tree

5 files changed

+86
-11
lines changed

5 files changed

+86
-11
lines changed

config.yml

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ template:
77
name: write-github-script
88
before:
99
- type: updateBranchProtection
10+
- type: createProjectBoard
11+
name: Learning Lab Project Board
12+
description: >-
13+
This board is used with the GitHub Actions: Using GitHub Script Learning Lab course.
14+
columns:
15+
- Triage Backlog
16+
- Triage Complete
1017
- type: createIssue
1118
title: Start here!
1219
body: 00_welcome-issue.md
@@ -95,14 +102,14 @@ steps:
95102
data:
96103
actionsUrl: "%payload.repository.html_url%/actions"
97104

98-
- title: Open an issue to trigger GitHub Script workflow
99-
description: Use GitHub script to comment when an issue is opened
105+
- title: Merge the new workflow into the master branch
106+
description: Make the workflow available for use on the repository
100107
event: pull_request.closed
101108
link: "{{ repoUrl }}/pull/2"
102109
actions:
103110
- type: updateBranchProtection
104111
- type: createIssue
105-
title: Create an issue comment
112+
title: Create an issue comment with GitHub Script
106113
body: 02_workflow-triggered.md
107114
action_id: triggerIssue
108115
- type: respond
@@ -111,8 +118,8 @@ steps:
111118
data:
112119
issueURL: "%actions.triggerIssue.data.html_url%"
113120

114-
- title: The workflow has commented
115-
description: a response after the workflow has run
121+
- title: Add another GitHub Script action
122+
description: Use GitHub Script to place this issue into a project board
116123
event: check_suite.completed
117124
link: "{{repoUrl}}/issues/3"
118125
actions:
@@ -122,10 +129,27 @@ steps:
122129
right: "GitHub Actions"
123130
else:
124131
- type: respond
125-
issue: Create an issue comment
132+
issue: Create an issue comment with GitHub Script
126133
with: debug.md
127134
data:
128135
debug: "%payload%"
129136
- type: respond
130137
with: 03_workflow-success.md
131-
issue: Create an issue comment
138+
issue: Create an issue comment with GitHub Script
139+
- type: octokit
140+
method: projects.listForRepo
141+
owner: "%payload.repository.owner.login%"
142+
repo: "%payload.repository.repo.name%"
143+
action_id: projectBoard
144+
- type: octokit
145+
method: projects.listColumns
146+
project_id: "%actions.projectBoard.data[0].id%"
147+
action_id: listColumns
148+
- type: respond
149+
with: 03_add-to-projects.md
150+
issue: Create and issue comment with GitHub Script
151+
data:
152+
listProj: "%actions.projectBoard%"
153+
listCol: "%actions.listColumns%"
154+
columnID: "%actions.listColumns.data[0].id%"
155+
quicklink: "%payload.repository.html_url%/edit/master/.github/workflows/my-workflow.yml%"

responses/01_merge-workflow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## You have triggered a workflow!
1+
## You have added a workflow!
22

33
Great job @{{user.login}}, you successfully added a workflow to this repository 🎉!
44

responses/02_workflow-triggered.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ on:
1010
types: [opened]
1111
```
1212
13-
This means that every time an issue get's opened in this repository the GitHub Script you wrote inside of it will execute.
13+
This means that every time an issue get's opened in this repository the GitHub Script you wrote will execute.
1414
1515
You should expect to see the result right here in this issue!
1616
1717
---
1818
19-
I'll respond in this issue after your workflow does!
19+
I'll respond in this issue after your workflow runs!

responses/03_add-to-projects.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# let's add a card to a project board
2+
3+
## Project board
4+
5+
{{listProj}}
6+
7+
## Column list
8+
9+
{{listCol}}
10+
11+
### :keyboard: Activity: Add newly opened issue to project board
12+
13+
You can use [this link]({{quicklink}}) to easily edit this file.
14+
15+
```yaml
16+
name: Learning GitHub Script
17+
18+
on:
19+
issues:
20+
types: [opened]
21+
22+
jobs:
23+
comment:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/github-script@0.8.0
27+
with:
28+
github-token: {% raw %}${{secrets.GITHUB_TOKEN}}{% endraw %}
29+
script: |
30+
github.issues.createComment({
31+
issue_number: context.issue.number,
32+
owner: context.repo.owner,
33+
repo: context.repo.repo,
34+
body: "🎉 You've created this issue comment using GitHub Script!!!"
35+
})
36+
github.projects.createCard({
37+
column_id: {{columnID}}
38+
content_id: context.payload.issue.id
39+
content_type: "Issue"
40+
});
41+
```

responses/03_workflow-success.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1-
# Congrats the workflow ran and I respond as expected
1+
# Success 🎉!!!
2+
3+
@{{user.login}} you're doing great! You've just used GitHub Script to comment on this issue!
4+
5+
## Why might this be useful?
6+
7+
Using GitHub Actions can really help automate the events that take place in your repositories. Imagine it was a repository visitor who opened a new issue containing information about a critical bug. I assume you'd want to thank them for bringing that to your attention, however this simple task can become overwhelming as your repository attracts more visitors. By automating an issue comment we could easily thank our visitors every single time without the overhead of doing it manually.
8+
9+
## What about us?
10+
11+
For the rest of the course we are going to design a workflow that helps us move issues into a GitHub Project board when they are created. This will give us increased visibility on the work that needs triage!

0 commit comments

Comments
 (0)