GitHub Actions for Beginners: Automate the Boring Stuff
GitHub Actions is a free automation runner built into GitHub. Every time you push code, a machine in the cloud can test it, build it, or deploy it — while you do nothing. Setup is one YAML file.
Your first workflow
Create the file .github/workflows/ci.yml:
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install -r requirements.txt
- run: python -m pytest
Push to main. The Actions tab in your repo lights up, shows each step live, and gives you a green check or a detailed log of what broke. That is the whole trick.
Reading the file
on:the triggers.push(code lands),pull_request(someone proposes a change), andschedule(cron syntax, for jobs that run on a timer)jobs:separate machines that can run in parallel; each job is a clean VM that is thrown away afterwardssteps:sequential commands inside a job —uses:pulls a prepared action from the marketplace,run:executes shell commands
Secrets
Never paste API keys into the YAML. Repo → Settings → Secrets and variables → Actions → add them, then reference as secrets.MY_KEY inside your workflow.
Three useful patterns
schedule:
- cron: "0 9 * * 1" # every Monday, 09:00 UTC
Scheduled jobs suit weekly reports or dependency refreshes. Next, the manual button:
on:
workflow_dispatch:
Adds a Run workflow button in the UI. And matrix builds (test on several versions at once) look like strategy.matrix.python: ["3.11","3.12"] inside a job.
Gotchas
- YAML is indentation-sensitive — two spaces, consistent everywhere
- Pin marketplace actions to a major version (
@v4) so updates do not break you silently - Minutes: workflows are free for public repositories; private repos draw from a monthly allowance — check current pricing on GitHub's site
Full reference: the official docs at docs.github.com/en/actions. A practical first project: auto-deploy your static site on every push — compare hosts in GitHub Pages vs Cloudflare Pages.
Need something like this built? I take freelance projects in streaming, web apps and automation. Get in touch.