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
Copy file name to clipboardExpand all lines: README.md
+74-34Lines changed: 74 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,50 +15,90 @@ _Write your own GitHub JavaScript Action and automate customized tasks unique to
15
15
</header>
16
16
17
17
<!--
18
-
<<< Author notes: Course start >>>
19
-
Include start button, a note about Actions minutes,
20
-
and tell the learner why they should take the course.
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!
21
23
-->
22
24
23
-
## Welcome
25
+
## Step 1: Initialize a new JavaScript project
24
26
25
-
Write your own GitHub JavaScript Action and automate customized tasks unique to your workflow.
27
+
_Welcome to the course :tada:_
26
28
27
-
-**Who is this for**: Developers, GitHub users, users new to Git, students, managers, and for teams.
28
-
-**What you'll learn**: How to consume actions within a workflow file, create custom JavaScript based actions and publish your newly created action to the marketplace.
29
-
-**Prerequisites**: Before you start, you should be familiar with GitHub, GitHub Actions, and Continuous Integration with GitHub Actions.
30
-
-**How long**: This course takes about 1 to 2 hours to be completed.
29
+
### Configuring a workflow
31
30
32
-
In this course, you will:
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.
33
32
34
-
1. Initialize a JavaScript project
35
-
2. Configure an action
36
-
3. Create a metadata file
37
-
4. Create JavaScript files
38
-
5. Add actions to workflow file
39
-
6. Trigger action
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.
40
34
41
-
### How to start this course
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.
42
36
43
-
<!-- For start course, run in JavaScript:
44
-
'https://github.com/new?' + new URLSearchParams({
45
-
template_owner: 'skills',
46
-
template_name: 'write-javascript-actions',
47
-
owner: '@me',
48
-
name: 'skills-write-javascript-actions',
49
-
description: 'My clone repository',
50
-
visibility: 'public',
51
-
}).toString()
52
-
-->
37
+
_In our case, we will use this one **workflow** file for many things, which leads us to break this convention for teaching purposes._
38
+
39
+
Read more about [workflows](https://docs.github.com/en/actions/writing-workflows/about-workflows)
40
+
41
+
## On to your development environment
42
+
43
+
Our JavaScript actions are going to leverage the [GitHub ToolKit](https://github.com/actions/toolkit) for developing GitHub Actions.
44
+
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
Once you have the necessary tools installed locally, follow these steps to begin creating your first action.
55
62
56
-
1. Right-click **Start course** and open the link in a new tab.
57
-
2. In the new tab, most of the prompts will automatically fill in for you.
58
-
- For owner, choose your personal account or an organization to host the repository.
59
-
- We recommend creating a public repository, as private repositories will [use Actions minutes](https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions).
60
-
- Scroll down and click the **Create repository** button at the bottom of the form.
61
-
3. After your new repository is created, wait about 20 seconds, then refresh the page. Follow the step-by-step instructions in the new repository's README.
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>
71
+
```
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):
9. Commit those newly added files,we will remove the need to upload **node_modules** in a later step:
93
+
```shell
94
+
git add .
95
+
git commit -m 'add project dependencies'
96
+
```
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.
0 commit comments