Answer
What is GitHub Actions?
GitHub Actions is a CI/CD and automation platform built directly into GitHub. It lets you automate workflows — build, test, lint, deploy, notify — triggered by events in your repository.
How It Works
CODE
GitHub Event (push, PR, schedule)
↓
Workflow file (.github/workflows/ci.yml) is triggered
↓
Runner (Ubuntu/Windows/macOS VM) is provisioned
↓
Jobs run (each job gets a fresh runner)
↓
Steps execute inside each job (shell commands or Actions)
↓
Results reported back to GitHub (pass/fail, logs, artifacts)
Key Concepts
CODE
Repository
└── .github/
└── workflows/
├── ci.yml ← runs tests on every push
├── deploy.yml ← deploys on merge to main
└── nightly.yml ← runs regression at 2 AM
Your First Workflow
YAML
# .github/workflows/hello.yml
name: Hello World
on:
push:
branches: [main]
jobs:
say-hello:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Say hello
run: echo "Hello from GitHub Actions!"
- name: Show runner info
run: |
echo "OS: ${{ runner.os }}"
echo "Branch: ${{ github.ref }}"
echo "Commit: ${{ github.sha }}"
GitHub Actions vs Jenkins
| Feature | GitHub Actions | Jenkins |
|---|---|---|
| Hosting | GitHub cloud (free tier) | Self-hosted |
| Setup | Zero — YAML in repo | Install + configure server |
| Runners | GitHub-hosted (free) | Your own agents |
| Marketplace | 20,000+ Actions | 1800+ plugins |
| Config | YAML in .github/workflows/ | Jenkinsfile / UI |
| Free tier | 2,000 min/month (public free) | Free (self-hosted cost) |
Components
- ✓Workflow — the YAML file that defines the automation
- ✓Event (trigger) — what causes the workflow to run
- ✓Job — a unit of work that runs on one runner
- ✓Step — an individual task inside a job
- ✓Action — a reusable step from GitHub Marketplace (e.g.,
actions/checkout@v4) - ✓Runner — the VM/container where jobs execute
- ✓Artifact — files saved after a job (test reports, builds)
- ✓Secret — encrypted variables (passwords, API keys)
