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.
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!
4
4
5
-
{{listProj}}
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
7
-
## Column list
7
+
<details><summary>Things aren't always as they appear!</summary>
8
+
<br>
9
+
Although this is not a course on octokit/rest.js, it is important to tell you a little secret right here before we move on. For you to be able to use the `projects.createCard()` method there were some pieces of information we needed beforehand. Things like the `column_id` so we know which column to add the card to and even a `project_id` so we know which board that column belongs to.
8
10
9
-
{{listCol}} -->
11
+
We've gone ahead and done this on our end of things so that we could give you the final piece to the puzzle and demonstrate how to use GitHub Script. So if you try to recreate this on your own, without the help of Learning Lab you will need to get that information and parse it in a way that works well for your use case!
12
+
13
+
</details>
10
14
11
15
### :keyboard: Activity: Add newly opened issue to project board
12
16
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
-
```
17
+
1.[Edit]({{quicklink}}) the current workflow `.github/workflows/my-workflow.yml` to have he following contents:
18
+
19
+
```yaml
20
+
name: Learning GitHub Script
21
+
22
+
on:
23
+
issues:
24
+
types: [opened]
25
+
26
+
jobs:
27
+
comment:
28
+
runs-on: ubuntu-latest
29
+
steps:
30
+
- uses: actions/github-script@0.8.0
31
+
with:
32
+
github-token: {% raw %}${{secrets.GITHUB_TOKEN}}{% endraw %}
33
+
script: |
34
+
github.issues.createComment({
35
+
issue_number: context.issue.number,
36
+
owner: context.repo.owner,
37
+
repo: context.repo.repo,
38
+
body: "🎉 You've created this issue comment using GitHub Script!!!"
39
+
})
40
+
github.projects.createCard({
41
+
column_id: {{columnID}},
42
+
content_id: context.payload.issue.id,
43
+
content_type: "Issue"
44
+
});
45
+
```
46
+
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`.
50
+
51
+
---
52
+
53
+
I'll respond in the new pull request when I detect it has been created.
You'r workflow now has the necessary updates for us to have new issues automatically added to the triage board when they are created!
6
+
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
+
9
+
Let's go ahead and do this now.
10
+
11
+
### :keyboard: Activity: Merge the workflow
12
+
13
+
When you are ready, merge this pull request.
14
+
15
+
---
16
+
17
+
Once you have merged this pull request I will open a new issue so we can see this workflow in action!
18
+
19
+
<details><summary>Trouble merging?</summary>Try refreshing the page!</details>
0 commit comments