The diagram below illustrates how to automatically trigger GitHub Actions jobs, during which they run, and how they interact with the code in your repository.
name: GitHub Actions Demo
on: [push]
jobs:
Explore-GitHub-Actions:
runs-on: ubuntu-latest
steps:
- run: echo "job was automatically triggered by a [null] event."
- run: echo "job is now running on a GitHub-hosted [null] server."
- run: echo "name of the branch is [null], repository is [null]."
- name: Check out repository code
uses: actions/checkout@v2
- run: echo "The [null] repository has been cloned to the runner."
- run: echo "The workflow is now ready to test your code on the runner."
- name: List files in the repository
run: |
ls ${{ github.workspace }}
- run: echo "This job's status is [null]."
- Create a new file called github-actions-demo.yml in the.github/workflows directory of your GitHub repository.
- In the github-actions-demo.yml file, copy the following YAML content:
- Choose Create a new branch for this commit and begin a pull request. Then, to make a pull request, go to File > Propose New File.
The push event is triggered and your workflow is run when you commit the workflow file to a branch in your repository.