Skip to content

Commit 7921efc

Browse files
Merge pull request #2 from Chau-Nguyen-Developer/test-workflow
Update Notes.md. Added comments for workflow example
2 parents 275ee6f + 613d1ab commit 7921efc

2 files changed

Lines changed: 29 additions & 2 deletions

File tree

Notes.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,31 @@
11
## Notes
22
* Workflows have jobs, and jobs have steps.
33
* Each step consists of either a shell script that is executed, or a reference to an action that is run. When we talk about an action in this context, we mean a reusable unit of code.
4-
* An action is a pre-defined, reusable set of jobs or code that perform specific tasks within a workflow.
4+
* An action is a pre-defined, reusable set of jobs or code that perform specific tasks within a workflow.
5+
6+
### Example of workflow
7+
_//The name of this workflow_
8+
name: Post welcome comment
9+
_//Trigger this workflow only when a PR is opened (not edited or closed)_
10+
on:
11+
pull_request:
12+
types: [opened]
13+
_//The workflow needs write permissions to comment on pull requests._
14+
permissions:
15+
pull-requests: write
16+
_//Define a job called "build". The name could be anything. It is just a label._
17+
jobs:
18+
build:
19+
name: Post welcome comment
20+
_//The runner (virtual machine) will be Ubuntu Linux._
21+
runs-on: ubuntu-latest
22+
_//The steps inside the job._
23+
steps:
24+
_//This step runs a command that posts a comment saying "Welcome to the repository!"_
25+
- run: gh pr comment $PR_URL --body "Welcome to the repository!"
26+
_//The below setting sets environment variables_
27+
env:
28+
_//A token that allows the GitHub CLI to authenticate_
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
_//The URL of the pull request that triggered the event._
31+
PR_URL: ${{ github.event.pull_request.html_url }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<header>
22

3-
# Hello GitHub Actions
3+
# Hello GitHub Actions 🎄🪴
44

55
_Create and run a GitHub Actions workflow._
66

0 commit comments

Comments
 (0)