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
+20-23Lines changed: 20 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,34 +6,27 @@ _Create and run a GitHub Actions workflow._
6
6
7
7
</header>
8
8
9
-
## Step 1: Create a workflow file
9
+
## Step 2: Add a job to your workflow file
10
10
11
-
_Welcome to "Hello GitHub Actions"! :wave:_
11
+
_Nice work! :tada: You added a workflow file!_
12
12
13
-
**What is _GitHub Actions_?**: GitHub Actions is a flexible way to automate nearly every aspect of your team's software workflow. You can automate testing, continuously deploy, review code, manage issues and pull requests, and much more. The best part, these workflows are stored as code in your repository and easily shared and reused across teams. To learn more, check out these resources:
13
+
Here's what the entries in the `welcome.yml` file, on the `welcome-workflow` branch, mean:
14
14
15
-
- The GitHub Actions feature page, see [GitHub Actions](https://github.com/features/actions).
16
-
- The "GitHub Actions" user documentation, see [GitHub Actions](https://docs.github.com/actions).
15
+
-`name: Post welcome comment` gives your workflow a name. This name will appear in the Actions tab of your repository.
16
+
-`on: pull_request: types: [opened]` indicates that your workflow will execute whenever someone opens a pull request in your repository.
17
+
-`permissions` assigns the workflow permissions to operate on the repository
18
+
-`pull-requests: write` gives the workflow permission to write to pull requests. This is needed to create the welcome comment.
17
19
18
-
**What is a _workflow_?**: A workflow is a configurable automated process that will run one or more jobs. Workflows are defined in special files in the `.github/workflows` directory and they execute based on your chosen event. For this exercise, we'll use a `pull_request` event.
20
+
Next, we need to specify jobs to run.
19
21
20
-
- To read more about workflows, jobs, and events, see "[Understanding GitHub Actions](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions)".
21
-
- If you want to learn more about the `pull_request` event before using it, see "[pull_request](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request)".
22
+
**What is a _job_?**: A job is a set of steps in a workflow that execute on the same runner (a runner is a server that runs your workflows when triggered). Workflows have jobs, and jobs have steps. Steps are executed in order and are dependent on each other. You'll add steps to your workflow later in the course. To read more about jobs, see "[Jobs](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions#jobs)".
22
23
23
-
To get you started, we ran an Actions workflow in your new repository that, among other things, created a branch for you to work in, called `welcome-workflow`.
24
+
In the following activity, you'll add a "build" job to your workflow. You'll specify `ubuntu-latest` as the fastest, and cheapest, job runner available. If you want to read more about why we'll use that runner, see the code explanation for the line `runs-on: ubuntu-latest` in the "[Understanding the workflow file](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions#understanding-the-workflow-file)" article.
24
25
25
-
### :keyboard: Activity: Create a workflow file
26
+
### :keyboard: Activity: Add a job to your workflow file
26
27
27
-
1. Open a new browser tab, and navigate to this same repository. Then, work on the steps in your second tab while you read the instructions in this tab.
28
-
1. Create a pull request. This will contain all of the changes you'll make throughout this part of the course.
29
-
30
-
Click the **Pull Requests** tab, click **New pull request**, set `base: main` and `compare:welcome-workflow`, click **Create pull request**, then click **Create pull request** again.
31
-
32
-
1. Navigate to the **Code** tab.
33
-
1. From the **main** branch dropdown, click on the **welcome-workflow** branch.
34
-
1. Navigate to the `.github/workflows/` folder, then select **Add file** and click on **Create new file**.
35
-
1. In the **Name your file** field, enter `welcome.yml`.
36
-
1. Add the following content to the `welcome.yml` file:
28
+
1. In a separate browser tab, make sure you are on the `welcome-workflow` branch and open your `.github/workflows/welcome.yml` file.
29
+
1. Edit the file and update its contents to:
37
30
38
31
```yaml copy
39
32
name: Post welcome comment
@@ -42,11 +35,15 @@ To get you started, we ran an Actions workflow in your new repository that, amon
42
35
types: [opened]
43
36
permissions:
44
37
pull-requests: write
38
+
jobs:
39
+
build:
40
+
name: Post welcome comment
41
+
runs-on: ubuntu-latest
45
42
```
46
43
47
-
1. To commit your changes, click **Commit changes**.
48
-
1. Type a commit message, select **Commit directly to the welcome-workflow branch** and click **Commit changes**.
49
-
1. Wait about 20 seconds, then refresh this page (the one you're following instructions from). A separate Actions workflow in the repository (not the workflow you created) will run and will automatically replace the contents of this README file with instructions for the next step.
44
+
1. Click **Commit changes** in the top right of the workflow editor.
45
+
1. Type a commit message and commit your changes directly to the `welcome-workflow` branch.
46
+
1. Wait about 20 seconds, then refresh this page (the one you're following instructions from). Another workflow will run and will replace the contents of this README file with instructions for the next step.
0 commit comments