GitHub Actions reference
11 August 2024 (Updated 11 August 2024)
In a nutshell
GitHub Actions let you run jobs when things happen in your GitHub repository.
For example, this .github/actions/master.yml
file (GitHub repo):
name: GitHub Actions Demo
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on:
push:
branches:
- master
jobs:
explore:
runs-on: ubuntu-latest
steps:
- uses: 'actions/checkout@v2'
- uses: 'actions/setup-node@v2'
with:
node-version: '20.16.0'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
Results in something like this:
Recipes
Control when a job runs
Pick an event that can trigger a workflow from the list here.
Then define that event in your .github/workflows/<workflow-name>.yml
:
on:
push:
branches:
- master
Use pre-built actions
Use secrets
Other notes
- Use act to run GitHub actions locally
- List of awesome GitHub actions
Tagged:
GitHub
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment