C.W.K.
Stream
Lesson 04 of 12 · published

Steps

~11 min · steps, run, uses

Level 0Apprentice
0 XP0/101 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

Steps run sequentially in one runner

Inside a job, steps run one after another on the same runner. The filesystem persists between steps. Failed step → job fails (unless continue-on-error).

A step is one of two things:

  1. A run: step — runs a shell command. Default shell: bash on Linux/macOS, pwsh on Windows.
  2. A uses: step — invokes a reusable action. Format: uses: org/repo@ref.

Common step fields

  • name — friendly name (shows in logs). Optional but kindly.
  • id — internal id (used to reference the step's outputs from later steps).
  • if — gates the step on an expression.
  • env — step-scoped env vars.
  • working-directory — start directory for the step.
  • shell — override default shell.
  • continue-on-error — let the step fail without failing the job.
  • timeout-minutes — kill the step after N minutes.
  • with — input map for a uses: action.

Code

Common step shapes·yaml
steps:
  # uses: invoke an action
  - uses: actions/checkout@v4
    with:
      fetch-depth: 0

  # uses + with: pin runtime version
  - uses: actions/setup-python@v5
    with:
      python-version: '3.12'

  # run: shell command
  - name: Install
    run: |
      python -m pip install --upgrade pip
      pip install -r requirements.txt

  # run + id: capture output for later steps
  - name: Get short SHA
    id: sha
    run: echo "sha=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT

  - name: Use captured output
    run: echo 'short SHA was ${{ steps.sha.outputs.sha }}'

External links

Exercise

Write a job with five steps: checkout, setup-node, install, lint, test. Give every step a name:. Add a sixth step that runs only when github.event_name == 'pull_request': echo 'this is a PR build'.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.