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

Commit cd16f6c

Browse files
committed
moar logic and responses
1 parent 455f681 commit cd16f6c

9 files changed

Lines changed: 121 additions & 85 deletions

config.yml

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ steps:
4141
data:
4242
title: Initial Workflow
4343
# if those gates === true Then do this stuff
44+
- type: closeIssue
45+
issue: Start Here!
4446
- type: respond
4547
with: 01_explain-workflow.md
4648
data:
@@ -101,49 +103,39 @@ steps:
101103
issueUrl: "%actions.devEnv.data.html_url%"
102104
pullRequest: Initial Workflow
103105
- type: mergePullRequest
104-
# - type: respond
105-
# with: 03_on-to-actions.md
106-
# data:
107-
# issueUrl: "%actions.devEnv.data.html_url%"
108-
109-
# - title: Install an editor and Node.js along with required packages
110-
# description: Installing the necessary tools and begin writing an Action
111-
# event: pull_request.closed # Change this to when the pr is merged
112-
# actions:
113-
# - type: respond
114-
# with: install-tools.md
115-
# issue: Setting up your development environment
116-
# - type: respond
117-
# with: 04_configure-env.md
118-
# issue: Setting up your development environment
119106

120107
- title: Creating the Action metadata
121108
description: Create an action.yml file and add necessary metatdata for our Action
122-
event: pull_request
109+
event: push
123110
# link: "{{ repoUrl }}/issue1/1"
124111
actions:
125112
- type: gate
126-
gates:
127-
# if the payload action is 'opened' OR 'edited'
128-
- left: "%payload.action%"
129-
operator: ===
130-
right: opened
131-
- left: "%payload.action%"
132-
operator: ===
133-
right: edited
134-
# AND the pull request title equals 'Initial Workflow'
113+
left: "%payload.ref%"
114+
operator: ===
115+
right: "refs/heads/hello-world"
135116
- type: gate
136-
left: "%payload.pull_request.title%"
117+
left: "%payload.created%"
137118
operator: ===
138-
right: Hello Actions
139-
140-
# if those statments FAIL... do this
141-
else:
142-
- type: respond
143-
with: e-rename-pr.md
144-
data:
145-
title: Initial Workflow
119+
right: true
120+
- type: createPullRequest
121+
title: Hello Action
122+
body: 04_explain-metadata.md
123+
head: hello-world
124+
action_id: helloPr
125+
- type: respond
126+
with: 04_hello-pr.md
127+
issue: Setting up your development environment
128+
data:
129+
pullUrl: "%actions.helloPr.data.html_url%"
146130
- type: closeIssue
147131
issue: Setting up your development environment
148132
- type: respond
149-
with: 04_explain-metadata.md
133+
with: 04_create-metadata.md
134+
issue: Hello Action
135+
136+
- title: Create the Action entrypoint
137+
description: time to start adding code to main.js
138+
event: pull_request.synchronize
139+
actions:
140+
- type: respond
141+
with: 04_explain-runs.md

responses/04_configure-env.md

Lines changed: 0 additions & 32 deletions
This file was deleted.

responses/04_create-metadata.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## Enough talk, lets do this!
2+
3+
Now that we know what Action metadata is, let's create the metadata for our current **hello-world** Action.
4+
5+
I will be doing this from within [Visual Studio Code](https://code.visualstudio.com/) and that will be reflected in the images that I show you. If you are using a different editor then your screen may look different.
6+
7+
### :keyboard: Activity: Create the metadata file
8+
9+
💡All of the following steps take place inside of the `.github/actions/hello-world` directory.
10+
11+
We will start with using the parameters that are **required** and later implement some optional parameters as our Action evolves.
12+
13+
1. Create a file named `action.yml`
14+
2. Use the `name` parameter to name your Action `"my hello action"`
15+
3. Next, add a `description` parameter and give it a value of `"say hello with Actions"`
16+
4. Lastly, define the `run` parameter to use `"node12"` to execute the `"main.js"` file that doesn't exist yet.
17+
18+
<details><summary>View the complete file</summary><img src="https://i.imgur.com/xCuBdI4.png" alt="screenshot of action.yml file" />
19+
20+
<details><summary>Raw code to copy</summary>
21+
22+
```yaml
23+
name: "my hello action"
24+
25+
description: "say hello with Actions"
26+
27+
runs:
28+
using: "node12"
29+
main: "main.js"
30+
```
31+
</details>
32+
33+
</details>
34+
35+
5. Save the `action.yml` file
36+
6. commit the changes:
37+
`git add .`
38+
`git commit -m 'update action.yml'`
39+
7. push them to the `hello-world` branch:
40+
`git push`
41+

responses/04_explain-metadata.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,22 @@
1-
### Explain action.yml
1+
## Action metadata
2+
3+
Every GitHub Action that we write needs to be accompanied by a metadata file. This file has a few rules to it, lets outline those now:
4+
5+
- Filename **must** be `action.yml`
6+
- Placed in the root directory of your Action
7+
- Required for both Docker container and JavaScript Actions
8+
- Written in YAML syntax
9+
10+
This file defines the following information about your Action:
11+
12+
<details><summary>Name</summary>This parameter is <b>required</b>. The name of your action. Helps visually identify the Actions in a job.</details>
13+
<details><summary>Author</summary>This parameter is <b>optional</b>. The name of who wrote the Action.</details>
14+
<details><summary>Description</summary>This parameter is <b>required</b>. A summary of what your Action does.</details>
15+
<details><summary>Inputs</summary>This parameter is <b>optional</b>. Input parameters allow you to specify data that the action expects to use during runtime. These parameters become environment variables in the runner.</details>
16+
<details><summary>Outputs</summary>This parameter is <b>optional</b>. Specifies the data that subsequent actions can use later in the workflow after the action that defines these outputs has run.</details>
17+
<details><summary>Runs</summary>This parameter is <b>required</b>. The command to run when the Action executes.</details>
18+
<details><summary>Branding</summary>This parameter is <b>optional</b>. You can use a color and Feather icon to create a badge to personalize and distinguish your action in GitHub Marketplace.</details>
19+
20+
---
21+
22+
📖Read more about [Action metadata](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/metadata-syntax-for-github-actions)

responses/04_explain-runs.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# explain runs

responses/04_hello-pr.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## Great job 👍
2+
3+
I have created a [new pull request]({{pullUrl}}) where we will continue this lesson. Click the link to meet me over there.
4+
5+
In the meantime I have closed this issue since we wont be needing it anymore 😄

responses/04_main-js.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
## some main js

responses/dev-env.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ If you do not have a preferred environment then I suggest following along with m
1212

1313
Most of your work going forward will take place away from your Learning Lab repository, so before continuing with the course ensure you have the following installed on your **local machine**.
1414

15-
1. [Node.js](https://nodejs.org)
16-
2. [Visual Studio Code](https://code.visualstudio.com/) or your editor of choice
17-
3. [Git](https://git-scm.com/)
15+
1. [ ] [Node.js](https://nodejs.org)
16+
2. [ ] [Visual Studio Code](https://code.visualstudio.com/) or your editor of choice
17+
3. [ ] [Git](https://git-scm.com/)
1818

1919

2020
### :keyboard: Activity: Configure your environment
@@ -23,7 +23,7 @@ Now that you have all the necessary tools installed locally, follow these steps
2323

2424
1. Open the **Terminal** (Mac and Linux) or **Command Prompt** (Windows) on your local machine
2525
2. Clone your Learning Lab repo to your local machine:
26-
`git clone https://{{repoUrl}}.git`
26+
`git clone {{repoUrl}}.git`
2727
<details><summary>View GIF</summary><img src="https://media.giphy.com/media/YnvmISGo2MbXpn2bc5/giphy.gif" alt="git clone example" /></details>
2828
<!-- ![alt text](https://media.giphy.com/media/YnvmISGo2MbXpn2bc5/giphy.gif) -->
2929

@@ -37,14 +37,28 @@ Now that you have all the necessary tools installed locally, follow these steps
3737

3838
5. Create a new folder for our Actions files:
3939
`mkdir -p .github/actions/hello-world`
40+
<details><summary>View GIF</summary><img src="https://media.giphy.com/media/Wn03sc0QsywHHD1LeN/giphy.gif" alt="create folder for action example" /></details>
4041
6. Navigate to the `hello-world` folder you just created:
4142
`cd .github/actions/hello-world`
42-
7. Initialize the a new project with `npm init -y`
43-
8. Install the **core** and **github** dependencies from the [GitHub ToolKit](https://github.com/actions/toolkit) by typing `npm install --save @actions/core @actions/github`
44-
9. Commit those newly added files, including `node_modules`, we will remove the need to upload `node_modules` in a later step
43+
<details><summary>View GIF</summary><img src="https://media.giphy.com/media/ckCMgczjpbjNwkfJq4/giphy.gif" alt="navigate to folder for action example" /></details>
44+
45+
7. Initialize a new project:
46+
`npm init -y`
47+
<details><summary>View GIF</summary><img src="https://media.giphy.com/media/mEW0fJYx4oUjdgYHDV/giphy.gif" alt="navigate to folder for action example" /></details>
48+
49+
8. Install the **core** and **github** dependencies from the [GitHub ToolKit](https://github.com/actions/toolkit):
50+
`npm install --save @actions/core @actions/github`
51+
<details><summary>View GIF</summary><img src="https://media.giphy.com/media/H3kGNqDI24lNOEKk5k/giphy.gif" alt="navigate to folder for action example" /></details>
52+
9. Commit those newly added files,we will remove the need to upload **node_modules** in a later step:
53+
`git add .`
54+
`git commit -m 'initial hello-world'`
4555
10. Push you changes to your repository:
4656
`git push -u origin hello-world`
47-
11. Create a new pull request from the `hello-world` branch to `master` with the title of `Hello Actions`
48-
- Take notice that the pull request name `Hello Actions` is case-sensitive
4957

50-
I will close this issue and continue responding to you in the `hello-actions` pull request once you have created it.
58+
59+
---
60+
61+
I will respond once you have finished.
62+
63+
64+

responses/install-tools.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)