Lesson content
Read, practise, then check your understanding
Introduction to GitHub Actions
GitHub Actions is GitHub's repository-native automation platform. It connects an event—such as a push, pull request, release, schedule, or manual request—to a workflow made of jobs. Teams use it for continuous integration, controlled delivery, releases, dependency maintenance, and repository operations.
Core ideas
- Continuous integration (CI) validates small, frequent changes through repeatable builds and checks.
- Continuous delivery keeps a verified artifact ready to release; continuous deployment also releases it automatically.
- A workflow is versioned with the application in
.github/workflows, so automation changes receive the same review as code. - Every trigger creates a workflow run. A run contains one or more jobs, and each job executes steps on a runner.
How it works
A practical first pipeline checks out the exact commit, installs dependencies reproducibly, and runs a deterministic validation command. A failing step normally fails its job and blocks dependent jobs. Branch protection can require the resulting check before a pull request merges.
Configuration example
name: CI
on:
pull_request:
push:
branches: [main]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run build
Read the example from top to bottom: the trigger creates a run, the job requests a runner, and each step receives only the context configured for it. Adapt names, versions, permissions, and commands to the repository rather than copying production credentials or policies blindly.
Production guidance
- Give workflows and jobs meaningful names because they appear in checks and run history.
- Separate validation from deployment, then protect deployment with environments and approvals.
- Treat workflow code as production code: review it, restrict permissions, and investigate unexpected changes.
The chapter quiz follows this lesson and checks both the vocabulary and the operational decisions behind the configuration.
Knowledge check
Answer every question correctly to complete this chapter.
0 of 10 checks passed
Your progress is saved on this device.