GitHub Actions
Native CI/CD β Automate Lint, Test & Deploy
What is GitHub Actions?
GitHub Actions is a CI/CD (Continuous Integration / Continuous Deployment) platform built directly into GitHub. It lets you automate your software workflow: every time you push code or open a pull request, it can automatically install dependencies, run linters, execute tests, build a Docker image, and deploy to production β all without leaving your repository. Workflows are defined as YAML files inside the .github/workflows/ folder.
Core Concepts
π Workflow
A YAML file in .github/workflows/ that defines an automated process triggered by events.
β‘ Trigger (on)
The event that starts a workflow β a push, a pull_request, a schedule, or a manual workflow_dispatch.
π§± Jobs & Steps
A workflow has jobs; each job runs a sequence of steps (commands or reusable Actions). Jobs can run in parallel or depend on each other.
π₯οΈ Runner
The virtual machine (Ubuntu, Windows, or macOS) that executes your job β hosted by GitHub or self-hosted.
π Actions
Reusable building blocks from the Marketplace, like actions/checkout or setup-python, that you compose into steps.
π Secrets
Encrypted variables (API keys, cloud credentials) stored in repo settings and injected securely at runtime.
Plans & Pricing
| Plan | Price | Included minutes / month | Ideal for |
|---|---|---|---|
| Free | $0 | 2,000 min (private) Β· unlimited for public repos | Open source, MVPs, personal projects |
| Team | USD 4 / user / month | 3,000 min | Small teams and growing SaaS |
| Enterprise | USD 21 / user / month | 50,000 min | Large orgs with compliance & SSO needs |
Practical Example: A CI Workflow (`.github/workflows/ci.yml`)
This workflow runs the linter and tests automatically on every push and pull request to main:
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- run: pip install -r requirements.txt ruff pytest
- run: ruff check .
- run: pytest -q
To go further, a second job can build a Docker image and run gcloud run deploy to ship to production β but only after the tests pass.