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
+8-35Lines changed: 8 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,45 +6,18 @@ _Create and run a GitHub Actions workflow._
6
6
7
7
</header>
8
8
9
-
## Step 3: Add a step to your workflow file
9
+
## Step 4: Merge your workflow file
10
10
11
-
_Nice work adding a job to your workflow! :dancer:_
11
+
_You're now able to write and run an Actions workflow! :sparkles:_
12
12
13
-
Workflows have jobs, and jobs have steps. So now we'll add a step to your workflow.
13
+
Merge your changes so the action will be a part of the `main` branch.
14
14
15
-
**What are _steps_?**: Actions steps run - in the order they are specified, from the top down - when a workflow job is processed. Each step must pass for the next step to run.
15
+
### :keyboard: Activity: Merge your workflow file
16
16
17
-
Each step consists of either a shell script that's executed, or a reference to an action that's run. When we talk about an action (with a lowercase "a") in this context, we mean a reusable unit of code. You can find out about actions in "[Finding and customizing actions](https://docs.github.com/en/actions/learn-github-actions/finding-and-customizing-actions)," but for now we'll use a shell script in our workflow step.
18
-
19
-
Update your workflow to make it post a comment on new pull requests. It will do this using a [bash](https://en.wikipedia.org/wiki/Bash_%28Unix_shell%29) script and [GitHub CLI](https://cli.github.com/).
20
-
21
-
### :keyboard: Activity: Add a step to your workflow file
22
-
23
-
1. Still working on the `welcome-workflow` branch, open your `welcome.yml` file.
24
-
1. Update the contents of the file to:
25
-
26
-
```yaml copy
27
-
name: Post welcome comment
28
-
on:
29
-
pull_request:
30
-
types: [opened]
31
-
permissions:
32
-
pull-requests: write
33
-
jobs:
34
-
build:
35
-
name: Post welcome comment
36
-
runs-on: ubuntu-latest
37
-
steps:
38
-
- run: gh pr comment $PR_URL --body "Welcome to the repository!"
39
-
env:
40
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41
-
PR_URL: ${{ github.event.pull_request.html_url }}
42
-
```
43
-
44
-
**Note:** The step you've added uses GitHub CLI (`gh`) to add a comment when a pull request is opened. To allow GitHub CLI to post a comment, we set the `GITHUB_TOKEN` environment variable to the value of the `GITHUB_TOKEN` secret, which is an installation access token, created when the workflow runs. For more information, see "[Automatic token authentication](https://docs.github.com/en/actions/security-guides/automatic-token-authentication)." We set the `PR_URL` environment variable to the URL of the newly created pull request, and we use this in the `gh` command.
45
-
46
-
1. Click **Commit changes** in the top right of the workflow editor.
47
-
1. Type your commit message and commit your changes directly to your branch.
17
+
1. In your repo, click on the **Pull requests** tab.
18
+
1. Click on the pull request you created in step 1.
19
+
1. Click **Merge pull request**, then click **Confirm merge**.
20
+
1. Optionally, click **Delete branch** to delete your `welcome-workflow` branch.
48
21
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