GitHub Actions
What is GitHub Actions?
Automation that runs in the cloud, triggered by events in your repository.
-
Runs on GitHub's servers
No local setup needed. Every contributor gets the same environment.
-
Triggered by events
Push a commit, open a pull request, merge to
main— Actions reacts automatically. -
The server-side safety net
Pre-commit hooks can be skipped locally. GitHub Actions can't be bypassed.
-
Reusable building blocks
Use community-built Actions from the GitHub Marketplace — no reinventing the wheel.
How does it work?
The flow
- You push code to GitHub
- GitHub reads your workflow files
- A runner (a fresh virtual machine) spins up
- Your steps execute in order
All pass → green tick on your PR
Any fail → red cross, merge is blocked
The workflow file
One YAML file defines everything:
name: Run tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- run: uv run pytest tests/
- Stored in
.github/workflows/ on:controls when it triggerssteps:are the commands to run
Pre-commit hooks vs GitHub Actions
-
Pre-commit hooks
Fast, local, immediate feedback. Runs before you can even push.
-
GitHub Actions
Server-side, can't be skipped, runs in a clean environment every time.
Use both
Hooks give you speed. Actions give you the guarantee. Together they cover every angle.