Paths/DevOps Engineer/CI/CD / Your First Pipeline
Write Your First GitHub Actions Workflow
A pipeline is a file in the repository — that's the whole trick. Create the exact directory layout GitHub Actions expects and write a workflow that runs on every push.
Validator
IDLE — checks run live as you type commands; submit when done
01Requirements
live checks- File ~/project/.github/workflows/ci.yml exists○
- Workflow triggers on push○
- Workflow checks out the code with actions/checkout○
02Walkthrough
9 steps- 01
Enter the project
Workflows always live inside the repository, in a hidden .github directory at the repo root.
cd ~/project - 02
Create the workflows directory
GitHub only picks up workflow files from .github/workflows/ — the path is not configurable.
mkdir -p ~/project/.github/workflows - 03
Start the workflow file
name is the display name; on: push is the trigger — the workflow runs on every push to the repository.
echo 'name: CI' > ~/project/.github/workflows/ci.yml - 04
Add the trigger
Append the trigger line. >> appends instead of overwriting.
echo 'on: push' >> ~/project/.github/workflows/ci.yml - 05
Add the job
jobs group steps; runs-on chooses the runner VM — ubuntu-latest is the standard choice.
echo 'jobs:' >> ~/project/.github/workflows/ci.yml - 06
Add the build job and checkout step
Every job starts from a fresh VM, so the first step is always actions/checkout@v4 to pull your code onto the runner.
echo ' build:' >> ~/project/.github/workflows/ci.yml - 07
Finish the workflow
Add runs-on, then steps with - uses: actions/checkout@v4. Run cat to review the whole file.
echo ' runs-on: ubuntu-latest' >> ~/project/.github/workflows/ci.yml - 08
Add the checkout step
Append the steps list with the checkout action — the line the validator looks for.
echo - uses: actions/checkout@v4 >> ~/project/.github/workflows/ci.yml - 09
Verify and submit
cat prints the finished workflow. Then submit — the validator parses the YAML you wrote.
cat ~/project/.github/workflows/ci.yml
03Stuck?
0 of 3 revealedTake a hint without losing the lab — each one points at the thing to look at, not at the answer.
04AI Tutor
guides, never solvesTell me what you're stuck on — I'll nudge, not solve. Which requirement are you looking at?
04Notebook
saved locally in this browserlearner@lab — ubuntu:24.04
Session is disposable
↑/↓ recalls commands · Ctrl+Enter submits · type help for the command list