🎓 A1Learner
🔍
0 of 50 lessons completed

GitHub Actions: Jobs and Steps

A job is one unit of work on one runner. A step is one action inside that job, and steps run in order.

One job

The test job holds all the steps for testing.

jobs:
  test:
    runs-on: ubuntu-latest

Steps in order

Fetch the code first. Then set up Node. Then run the tests.

    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-node@v7
      - run: npm test

A second job

A second job starts a fresh runner. It does not share the first job.

jobs:
  test:
    runs-on: ubuntu-latest
  build:
    runs-on: ubuntu-latest

A lint step after the tests

Linting checks the code for mistakes. It runs after the tests here.

      - run: npm test
      - run: npm run lint

Example

name: Jobs and Steps
on: push
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-node@v7
        with:
          node-version: '24'
      - run: npm test
      - run: npm run lint

Key points

  • Use a job to group steps that belong together.
  • Steps in one job share the same runner and the same fetched code.
  • Steps run in order, from the first to the last.
  • A failed step stops the rest of the job.
  • A job is the unit that runs on a runner, not a step.
  • Jobs and steps are the two levels of a workflow, stated in plain words.

In this example, the workflow is saved as .github/workflows/jobs-and-steps.yml. It has one job, called test. Its four steps run in order on one Ubuntu runner. They fetch the code, set up Node 24, run the tests, and then run the lint check. The output shows both tests passing, and the lint step prints nothing when the code is clean.

Try it Yourself

Edit the code, then press Run.

Running is simulated · Rust Playground

Exercise

In what order do the steps in one job run?