Skip to content

Commit 1963394

Browse files
Update Notes.md. Added comments for workflow example
1 parent 275ee6f commit 1963394

1 file changed

Lines changed: 28 additions & 1 deletion

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 }}

0 commit comments

Comments
 (0)