← Cheat Sheets

GitHub Actions Workflow Syntax

A minimal CI workflow and key keywords.

# GitHub Actions Workflow Syntax

A minimal CI workflow and key keywords.

```yaml
name: CI
on:
  push:
    branches: [main]
  pull_request:
jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node: [20, 22]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node }}
          cache: npm
      - run: npm ci
      - run: npm test
        env:
          API_KEY: ${{ secrets.API_KEY }}
```

Other keys: `needs:` (job order), `if:` (conditions), `workflow_dispatch` (manual run), `schedule:` with cron.