You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 1, 2022. It is now read-only.
This is the description we show on the course page [here](https://lab.github.com/githubtraining/write-github-script). This first paragraph will be featured at the top of the page so make it great.
2
-
1
+
[GitHub Script](https://github.com/actions/github-script) is a special action that allows using [octokit/rest.js](https://octokit.github.io/rest.js/v17) directly in a workflow file.
3
2
4
-
5
-
Be sure to tell the learner about the technology you are teaching, why they should learn it, how they can use it, and what you will teach them.
6
-
3
+
Over the duration of this course you will learn the skills needed to begin using the GitHub Script action to interact with your repository which will save you from creating full blown actions that carry unnecessary overhead.
7
4
5
+
## What you'll learn
8
6
9
-
Include information on how they can reach you for questions about the content or course.
7
+
In this course you will learn how to:
8
+
9
+
- Use GitHub Script in your workflow
10
+
- Comment on issues using octokit
11
+
- Add issues to a project board using octokit
12
+
- Use the workflow expression syntax to filter when jobs run in a workflow.
13
+
14
+
## What you'll build
15
+
16
+

17
+
18
+
In this course you will automatically generate a comment on every new issue using a templated response. Additionally, if this issue is labeled as a bug it will be automatically added to the "needs triage" column of a project board.
19
+
20
+
## Prerequisites
21
+
22
+
We first recommend taking the following courses:
23
+
24
+
-[Hello, GitHub Actions!](https://lab.github.com/github/hello-github-actions!) to learn the basics of how GitHub Actions work
25
+
-[GitHub Actions: Continuous Integration](https://lab.github.com/githubtraining/github-actions:-continuous-integration) to dive deeper into a workflow file
26
+
27
+
## Projects used
28
+
29
+
This makes use of the following open source projects. Consider exploring these repos and maybe even making contributions!
30
+
31
+
-[GitHub Script](https://github.com/actions/github-script), a unique action that provides an authenticated octokit client and allows JavaScript to be written directly in a workflow file.
Copy file name to clipboardExpand all lines: responses/00_welcome-activity.md
+11-7Lines changed: 11 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ Your repository can contain multiple **workflow** files that carry out a wide va
20
20
21
21
📖 Read more about [workflows](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/configuring-a-workflow#choosing-the-type-of-actions-for-your-workflow)
22
22
23
-
### :keyboard: Activity: Respond to an issue when it get's opened
23
+
### :keyboard: Activity: Respond to an issue when it gets opened
24
24
25
25
1. Create a new workflow file titled `.github/workflows/my-workflow.yml` with the following contents:
26
26
You can use [this quicklink]({{quicklink}}) to easily create this file
@@ -49,17 +49,21 @@ Your repository can contain multiple **workflow** files that carry out a wide va
49
49
```
50
50
51
51
1. Commit the workflow to a new branch.
52
-
1. Create a pull request titled **Create my-workflow.yml**.
53
-
1. Supply the pull request body content and click `Create pull request`.
52
+
1. Create a pull request. I suggest a title like **Automate issue responses**.
53
+
1. Supply the pull request body content and click **Create pull request**.
54
54
55
-
_It is important to place meaningful content into the body of the pull requests you create throughout this course. This repository will stay with you long after you complete the course. It is advisable that you use the body of the pull requests you create as a way to take long lived notes about thing you want to remember._
55
+
<details><summary>About pull pull request titles and content</summary>
56
56
57
-
<details><summary>Suggested body content</summary>
57
+
It is important to place meaningful content into the body of the pull requests you create. This repository will stay with you long after you complete the course. We recommend you use the body of your pull requests as a way to take long lived notes about thing you want to remember.
58
58
59
-
`Workflow files are the recipe for task automation. This is where actions are placed if I want to use them for a task.`
59
+
In practice, good pull request titles and content convey information efficiently to your collaborators.
60
+
61
+
You can fill the body of this pull request with the following recommended content:
62
+
63
+
> Workflow files are the recipe for task automation. This is where actions are placed if I want to use them for a task.
60
64
61
65
</details>
62
66
63
67
---
64
68
65
-
I'll respond in the new pull request when I detect it has been created.
69
+
I am waiting for you to create a new pull request before moving on.
Copy file name to clipboardExpand all lines: responses/03_add-to-projects.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Let's add a card to a project board
2
2
3
-
We have added a project board to this repository for you. We will use this board, named **Learning Lab Project Board**, to add cards to when a new issue is created in your repository!
3
+
We have added [a project board]({{ store.projectUrl }}) to this repository for you. We will use this board, named **Learning Lab Project Board**, to add cards to when a new issue is created in your repository!
4
4
5
5
Like creating comments and opening pull requests, octokit/rest.js can be used for many more types of interactions. Managing GitHub Projects makes that list!
6
6
@@ -45,9 +45,11 @@ We've gone ahead and done this on our end of things so that we could give you th
45
45
```
46
46
47
47
2. Commit the workflow to a new branch.
48
-
3. Create a pull request titled **Update my-workflow.yml**.
49
-
4. Supply the pull request body content and click `Create pull request`.
48
+
3. Create a pull request, I suggest the title **Add issues to project board**.
49
+
4. Supply the pull request body content and click **Create pull request**.
50
50
51
51
---
52
52
53
+
I am waiting for you to create a new pull request before moving on.
54
+
53
55
I'll respond in the new pull request when I detect it has been created.
Copy file name to clipboardExpand all lines: responses/04_merge-workflow.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
@{{user.login}}, you're a rockstar ✨
4
4
5
-
You'r workflow now has the necessary updates for us to have new issues automatically added to the triage board when they are created!
5
+
Your workflow now has the necessary updates for us to have new issues automatically added to the triage board when they are created!
6
6
7
7
Like before, this workflow has a trigger that pertains to the repository as a whole, rather than just this branch, we will need to merge this pull request before we can start using it.
8
8
@@ -14,6 +14,8 @@ When you are ready, merge this pull request.
14
14
15
15
---
16
16
17
+
I am waiting for you to merge this pull request before moving on.
18
+
17
19
Once you have merged this pull request I will open a new issue so we can see this workflow in action!
18
20
19
21
<details><summary>Trouble merging?</summary>Try refreshing the page!</details>
0 commit comments