Skip to main content

Introduction to GitHub Actions


Table of contents

  1. What is GitHub Actions?
  2. Key concepts
  3. Benefits of GitHub Actions
  4. First workflow
  5. GitHub Actions interface
  6. 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

CategoryExamples
CIAutomated tests, linting, build
CDStaging/production deployment
AutomationRelease notes, automatic labels
SecurityVulnerability scanning, audit
DevOpsInfrastructure as Code, backups

Comparison with other tools

ToolTypeAdvantagesDrawbacks
GitHub ActionsIntegratedFree, native to GitHubLimited to GitHub
JenkinsSelf-hostedVery flexibleMaintenance
GitLab CIIntegratedCompleteGitLab ecosystem
CircleCISaaSPerformanceCost

🔝 Back to table of contents



2 - Key concepts

Essential vocabulary

Definitions

TermDescription
WorkflowYAML file that defines the automation
EventTrigger (push, PR, schedule...)
JobA set of steps run on a runner
StepAn individual task (action or command)
ActionA reusable block (from the Marketplace or custom)
RunnerThe machine that runs the jobs
ArtifactA file produced by a workflow

File structure

.github/
└── workflows/
├── ci.yml # Tests et build
├── cd.yml # Déploiement
└── release.yml # Publication

Types of runners

RunnerOSSpecsUsage
ubuntu-latestLinux2 CPU, 7GB RAMDefault
windows-latestWindows2 CPU, 7GB RAMWindows apps
macos-latestmacOS3 CPU, 14GB RAMiOS/macOS apps
Self-hostedCustomYour hardwareSpecific needs

🔝 Back to table of contents



3 - Benefits of GitHub Actions

Why choose GitHub Actions?

BenefitDescription
IntegratedNo external configuration
Free2000 min/month for public repos
Marketplace+15000 ready-to-use actions
YAMLVersioned Configuration as Code
Multi-OSLinux, Windows, macOS
CommunityRich documentation and support

Pricing

PlanMinutes/monthStorage
Free2,000500 MB
Team3,0002 GB
Enterprise50,00050 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

  1. Go to your GitHub repository
  2. Click the Actions tab
  3. See the available workflows
  4. Click a run for the details

Interface elements

ElementDescription
WorkflowsList of defined workflows
RunsExecution history
JobsJobs of a specific run
LogsDetailed output of each step
ArtifactsProduced files
SummaryRun summary

Statuses

StatusIconMeaning
SuccessAll jobs succeeded
FailureAt least one job failed
CancelledCancelled manually
Skipped⏭️Job skipped (condition)
In progress🟡Currently running
QueuedWaiting for a runner

Status badges

<!-- Dans votre README.md -->
![CI](https://github.com/USER/REPO/actions/workflows/ci.yml/badge.svg)

🔝 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

🔝 Back to table of contents


Next chapter: Workflow syntax →