🎓 A1Learner
🔍
0 of 50 lessons completed

GitHub Actions: What Is an Action?

An action is a reusable step in a workflow. It is a small packaged task that somebody else wrote and shared.

A step that runs a command

This step runs a command on the runner.

- run: npm test

A step that uses an action

This step runs an action from the Marketplace.

- uses: actions/checkout@v7

The two kinds side by side

Both steps sit in the same steps list.

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

An action with an input

Some actions take inputs. The with: block sets them.

- uses: actions/setup-node@v7
  with:
    node-version: '24'

Example

name: Actions intro

on: push

jobs:
  intro:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-node@v7
        with:
          node-version: '24'
      - run: npm test

Key points

  • Action: a reusable step that runs one task in a workflow.
  • Use uses: to run an action in a step.
  • Use run: to run a shell command in a step.
  • Actions come from the Marketplace, a shared library of actions.
  • An action saves writing the same commands in every workflow.
  • The same action can run in many workflows.
  • Actions carry a version tag, like @v7.
  • An action is a ready-made step, not a command you type yourself.

In this example, the workflow runs on every push. The first step uses actions/checkout to download the repo. The second step uses actions/setup-node to install Node 24. The third step runs the tests with a plain command. Two actions and one command work together in one job.

Note

A workflow step uses either uses: or run:, never both in one step.

Try it Yourself

Edit the code, then press Run.

Running is simulated · Rust Playground

Exercise

What does uses: do in a workflow step?