Skip to content

Commit 1015bb4

Browse files
Update to 2 in STEP and README.md
1 parent 3c5cb4a commit 1015bb4

File tree

2 files changed

+27
-70
lines changed

2 files changed

+27
-70
lines changed

.github/steps/-step.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1
1+
2

README.md

Lines changed: 26 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -15,90 +15,47 @@ _Write your own GitHub JavaScript Action and automate customized tasks unique to
1515
</header>
1616

1717
<!--
18-
<<< Author notes: Step 1 >>>
19-
Choose 3-5 steps for your course.
20-
The first step is always the hardest, so pick something easy!
21-
Link to docs.github.com for further explanations.
22-
Encourage users to open new tabs for steps!
18+
<<< Author notes: Step 2 >>>
19+
Start this step by acknowledging the previous step.
20+
Define terms and link to docs.github.com.
2321
-->
2422

25-
## Step 1: Initialize a new JavaScript project
23+
## Step 2: Configure Your Action
2624

27-
_Welcome to the course :tada:_
25+
_Let's keep going! :bike:_
2826

29-
### Configuring a workflow
27+
### Excellent!
3028

31-
Actions are enabled on your repository by default, but we still have to tell our repository to use them. We do this by creating a workflow file in our repository.
29+
Now that we have the custom action pre-requisites, let us create **joke-action** action.
3230

33-
A **workflow** file can be thought of as the recipe for automating a task. They house the start to finish instructions, in the form of `jobs` and `steps`, for what should happen based on specific triggers.
31+
### :keyboard: Activity 1: Configure Your Action
3432

35-
Your repository can contain multiple **workflow** files that carry out a wide variety of tasks. It is important to consider this when deciding on a name for your **workflow**. The name you choose should reflect the tasks being performed.
33+
All of the following steps take place inside of the `.github/actions/joke-action` directory.
3634

37-
_In our case, we will use this one **workflow** file for many things, which leads us to break this convention for teaching purposes._
35+
We will start with using the parameters that are **required** and later implement some optional parameters as our action evolves.
3836

39-
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)
37+
1. Create a new file in: `.github/actions/joke-action/action.yml`
38+
2. Add the following contents to the `.github/actions/joke-action/action.yml` file:
4039

41-
## On to your development environment
40+
```yaml
41+
name: "my joke action"
4242

43-
Our JavaScript actions are going to leverage the [GitHub ToolKit](https://github.com/actions/toolkit) for developing GitHub Actions.
43+
description: "use an external API to retrieve and display a joke"
4444

45-
This is an external library that we will install using `npm` which means that you will need [Node.js](https://nodejs.org/) installed.
46-
47-
We find writing actions to be easier from a local environment vs trying to do everything right here in the repository. Doing these steps locally allows you to use the editor of your choice so that you have all the extensions and snippets you are used to when writing code.
48-
49-
If you do not have a preferred environment then we suggest following along exactly as you see on the screen, which means you'll need to install [Visual Studio Code](https://code.visualstudio.com/).
50-
51-
## Don't forget to set up your workstation
52-
53-
Most of your work going forward will take place away from your Skills repository, so before continuing with the course ensure you have the following installed on your **local machine**.
54-
55-
1. [ ] [Node.js](https://nodejs.org)
56-
2. [ ] [Visual Studio Code](https://code.visualstudio.com/) or your editor of choice
57-
3. [ ] [Git](https://git-scm.com/)
58-
59-
### :keyboard: Activity 1: Initialize a new JavaScript project
60-
61-
Once you have the necessary tools installed locally, follow these steps to begin creating your first action.
62-
63-
1. Open the **Terminal** (Mac and Linux) or **Command Prompt** (Windows) on your local machine
64-
2. Clone your Skills repo to your local machine:
65-
```shell
66-
git clone <this repository URL>.git
67-
```
68-
3. Navigate to the folder you just cloned:
69-
```shell
70-
cd <local folder with cloned repo>
45+
runs:
46+
using: "node16"
47+
main: "main.js"
7148
```
72-
4. We are using branch called `main`.
73-
```shell
74-
git switch main
75-
```
76-
5. Create a new folder for our actions files:
77-
```shell
78-
mkdir -p .github/actions/joke-action
79-
```
80-
6. Navigate to the `joke-action` folder you just created:
81-
```shell
82-
cd .github/actions/joke-action
83-
```
84-
7. Initialize a new project:
85-
```shell
86-
npm init -y
87-
```
88-
8. Install the **request**, **request-promise** and **@actions/core** dependencies using `npm` from the [GitHub ToolKit](https://github.com/actions/toolkit):
89-
```shell
90-
npm install --save request request-promise @actions/core
91-
```
92-
9. Commit those newly added files,we will remove the need to upload **node_modules** in a later step:
49+
50+
3. Save the `action.yml` file
51+
4. Commit the changes and push them to the `main` branch:
9352
```shell
94-
git add .
95-
git commit -m 'add project dependencies'
53+
git add action.yml
54+
git commit -m 'create action.yml'
55+
git pull
56+
git push
9657
```
97-
10. Push your changes to your repository:
98-
```shell
99-
git push
100-
```
101-
11. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step.
58+
5. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step.
10259

10360
<footer>
10461

0 commit comments

Comments
 (0)