Sikau

GitHub Actions · Day 3 · about 30 min

Steps and actions

checkout, setup-node, run, working-directory and reading failures.

The runner starts empty

A fresh runner has no copy of your code. Steps fix that: actions are reusable building blocks (uses:) — actions/checkout downloads the repository, actions/setup-node installs the Node.js version you need — and run: does the rest.

uses and run

name: CI
on: push
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Without checkout
        run: ls
      - uses: actions/checkout@v4
      - name: With checkout
        run: ls
      - uses: actions/setup-node@v4
        with:
          node-version: 22
      - run: node --version
      - run: npm ci
      - run: npm test
  • Failed step → later steps are skipped and the job fails.
  • Read the log from the first red step: the real error is usually right there.
  • working-directory: api runs a step inside a sub-folder.

The rest of this lesson

  • Inputs to actionsexplain
  • Trusting third-party actionsexplain
  • What fails?predict
  • Standard step orderorder
  • Your turnwrite code
  • Badge quizquiz
  • What you learnedrecap

Continue this lesson free — run real code in your browser

Continue with Google

See all 12 lessons of GitHub Actions