What GitHub Actions is

GitHub Actions · Essentials · 6 min

You need the vocabulary before any YAML makes sense, and it tells you where each piece of work actually runs.

GitHub Actions is GitHub's automation service. You describe automation in workflow files, YAML stored in .github/workflows/ in the repository, and GitHub runs them when an event happens: a push, a pull request being opened, a release, a cron schedule or a manual button press.

A workflow contains one or more jobs. Each job runs on a runner, a fresh virtual machine (or container) that GitHub provisions for that job only: ubuntu-latest, windows-latest or macos-latest, or a machine you host yourself. Jobs run in parallel by default and do not share a file system.

A job is a list of steps executed in order on the same runner, so steps do share files. A step either runs a shell command (run:) or calls an action (uses:), a reusable unit such as actions/checkout that clones your repository.

  • Event: what starts the workflow.
  • Job: a group of steps on one runner.
  • Step: one command or action.
  • Runner: the machine that executes a job.

For public repositories the standard hosted runners are free; private repositories get a monthly allowance of minutes. Every run is shown in the repository's Actions tab with logs per step, and its status appears as a check on commits and pull requests, which is what makes Actions useful as CI.

Example

# .github/workflows/hello.yml
name: Hello              # shown in the Actions tab
on: push                 # event
jobs:
  greet:                 # job id
    runs-on: ubuntu-latest   # runner
    steps:
      - uses: actions/checkout@v7      # step using an action
      - run: echo "Hello from $GITHUB_REPOSITORY"   # step running a command
      - run: ls                         # sees the checked-out files

Remember

  • Workflows are YAML files in .github/workflows/
  • An event starts a workflow; a workflow has jobs; a job has steps
  • Each job gets a fresh runner; steps in one job share its files

Watch out for

  • Expecting two jobs to see each other's files: they run on different machines.

Check yourself

  1. Two steps in the same job and two jobs in the same workflow: which pair shares a file system?

Sign in to answer, see the explanations, and get this lesson back as a quick review later.

Official docs: docs.github.com/en/actions/get-started/understand-github-actions

Builds on

Nothing: this is a foundation.

Unlocks