Introduction to GitHub Actions
Table of contents
- What is GitHub Actions?
- Key concepts
- Benefits of GitHub Actions
- First workflow
- GitHub Actions interface
- Practical exercises
1 - What is GitHub Actions?
Definition
GitHub Actions is a CI/CD automation platform integrated directly into GitHub. It lets you automate tasks in response to events on your repository.
Use cases
| Category | Examples |
|---|---|
| CI | Automated tests, linting, build |
| CD | Staging/production deployment |
| Automation | Release notes, automatic labels |
| Security | Vulnerability scanning, audit |
| DevOps | Infrastructure as Code, backups |
Comparison with other tools
| Tool | Type | Advantages | Drawbacks |
|---|---|---|---|
| GitHub Actions | Integrated | Free, native to GitHub | Limited to GitHub |
| Jenkins | Self-hosted | Very flexible | Maintenance |
| GitLab CI | Integrated | Complete | GitLab ecosystem |
| CircleCI | SaaS | Performance | Cost |
🔝 Back to table of contents
2 - Key concepts
Essential vocabulary
Definitions
| Term | Description |
|---|---|
| Workflow | YAML file that defines the automation |
| Event | Trigger (push, PR, schedule...) |
| Job | A set of steps run on a runner |
| Step | An individual task (action or command) |
| Action | A reusable block (from the Marketplace or custom) |
| Runner | The machine that runs the jobs |
| Artifact | A file produced by a workflow |
File structure
.github/
└── workflows/
├── ci.yml # Tests et build
├── cd.yml # Déploiement
└── release.yml # Publication
Types of runners
| Runner | OS | Specs | Usage |
|---|---|---|---|
ubuntu-latest | Linux | 2 CPU, 7GB RAM | Default |
windows-latest | Windows | 2 CPU, 7GB RAM | Windows apps |
macos-latest | macOS | 3 CPU, 14GB RAM | iOS/macOS apps |
| Self-hosted | Custom | Your hardware | Specific needs |
🔝 Back to table of contents
3 - Benefits of GitHub Actions
Why choose GitHub Actions?
| Benefit | Description |
|---|---|
| Integrated | No external configuration |
| Free | 2000 min/month for public repos |
| Marketplace | +15000 ready-to-use actions |
| YAML | Versioned Configuration as Code |
| Multi-OS | Linux, Windows, macOS |
| Community | Rich documentation and support |
Pricing
| Plan | Minutes/month | Storage |
|---|---|---|
| Free | 2,000 | 500 MB |
| Team | 3,000 | 2 GB |
| Enterprise | 50,000 | 50 GB |
Tip
Public repos have unlimited free minutes!
Ecosystem
🔝 Back to table of contents
4 - First workflow
Hello World
# .github/workflows/hello.yml
name: Hello World
on:
push:
branches: [main]
workflow_dispatch: # Permet l'exécution manuelle
jobs:
greet:
runs-on: ubuntu-latest
steps:
- name: Say Hello
run: echo "Hello, GitHub Actions! 🚀"
- name: Show date
run: date
- name: Show system info
run: |
echo "OS: $(uname -a)"
echo "User: $(whoami)"
echo "Directory: $(pwd)"
Line-by-line explanation
name: Hello World # Nom affiché dans l'interface
on: # Événements déclencheurs
push:
branches: [main] # Seulement sur la branche main
jobs: # Liste des jobs
greet: # Nom du job
runs-on: ubuntu-latest # Runner à utiliser
steps: # Liste des étapes
- name: Say Hello # Nom de l'étape
run: echo "..." # Commande shell
Create the workflow
# Dans votre repo
mkdir -p .github/workflows
nano .github/workflows/hello.yml
# Collez le contenu ci-dessus
git add .github/workflows/hello.yml
git commit -m "Add first workflow"
git push
Workflow with checkout
name: Build Project
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: List files
run: ls -la
- name: Show README
run: cat README.md || echo "No README"
🔝 Back to table of contents
5 - GitHub Actions interface
Access the workflows
- Go to your GitHub repository
- Click the Actions tab
- See the available workflows
- Click a run for the details
Interface elements
| Element | Description |
|---|---|
| Workflows | List of defined workflows |
| Runs | Execution history |
| Jobs | Jobs of a specific run |
| Logs | Detailed output of each step |
| Artifacts | Produced files |
| Summary | Run summary |
Statuses
| Status | Icon | Meaning |
|---|---|---|
| Success | ✅ | All jobs succeeded |
| Failure | ❌ | At least one job failed |
| Cancelled | ⚪ | Cancelled manually |
| Skipped | ⏭️ | Job skipped (condition) |
| In progress | 🟡 | Currently running |
| Queued | ⏳ | Waiting for a runner |
Status badges
<!-- Dans votre README.md -->

🔝 Back to table of contents
6 - Practical exercises
Exercise 1: First workflow
Create a workflow that displays "Hello from GitHub Actions!" on every push:
Solution
# .github/workflows/hello.yml
name: Hello
on: [push]
jobs:
hello:
runs-on: ubuntu-latest
steps:
- run: echo "Hello from GitHub Actions!"
Exercise 2: Workflow with system information
Create a workflow that displays the runner's information:
Solution
name: System Info
on: [push]
jobs:
info:
runs-on: ubuntu-latest
steps:
- name: OS Info
run: |
echo "OS: $(uname -s)"
echo "Kernel: $(uname -r)"
echo "Architecture: $(uname -m)"
- name: Disk Space
run: df -h
- name: Memory
run: free -h
Quiz
Q1. Where are workflow files stored?
Answer
In .github/workflows/ at the root of the repository.
Q2. Which runner is recommended by default?
Answer
ubuntu-latest - It is the fastest and cheapest.
Q3. Which action retrieves the repo's code?
Answer
actions/checkout@v4
🔝 Back to table of contents
Key takeaways
- GitHub Actions = CI/CD integrated into GitHub
- Workflows defined in YAML in
.github/workflows/ - Triggered by events (push, PR, schedule...)
- Run on runners (ubuntu, windows, macos)
- actions/checkout to retrieve the code
- Free for public repos