Skip to content

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

  1. You push code to GitHub
  2. GitHub reads your workflow files
  3. A runner (a fresh virtual machine) spins up
  4. Your steps execute in order
  5. ✅ All pass → green tick on your PR
  6. ❌ Any fail → red cross, merge is blocked

The workflow file

One YAML file defines everything:

.github/workflows/tests.yml
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 triggers
  • steps: 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.