Lesson 7 / 21

A Minimal Workflow

Trigger a workflow on push and run your tests automatically.

What GitHub Actions is

GitHub Actions is GitHub's built-in CI/CD engine. You define workflows as YAML files in .github/workflows/, and GitHub runs them on events like a push or pull request.

Run tests on every push

This workflow triggers on a push to main, checks out the code, sets up Node, installs dependencies, and runs the test suite.

name: CI
on:
  push:
    branches: [main]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npm ci
      - run: npm test

Output:

Runs automatically on GitHub-hosted infrastructure

Where the file lives

Every file under .github/workflows/*.yml is a separate workflow. GitHub picks them up automatically — no separate setup or dashboard configuration needed.