Reference

CI/CD workflows

Compare GitHub Actions and GitLab CI syntax for checks, artifacts, permissions and release controls.

Scope and conventions

GitHub Actions (hosted Ubuntu) and GitLab CI. Rows are independent; fragments need the stated placement and prerequisites. npm examples need package-lock.json and a test script. Pins checked 7 November 2026: checkout v7.0.1, setup-node v7.1.0, upload-artifact v7.0.2, download-artifact v8.0.2. Runner, permission and approval requirements are named; review pins for updates.

Files, triggers & runners

Run an existing project’s checks

GitHub Actions

A workflow file declares triggers and a job. Checkout and runtime setup precede project commands; this runs the repository’s existing npm test script, not an unspecified built-in test suite.

Complete file

Complete workflow file for the existing npm project described above. GitHub-hosted runner assumed; SHA pins should be reviewed for updates.

.github/workflows/checks.yml
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
name: Checks
on: [push, pull_request]
permissions:
  contents: read
jobs:
  test:
    runs-on: ubuntu-24.04
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
        with:
          node-version: '26'
          cache: npm
      - run: npm ci
      - run: npm test

Select events and branches deliberately

GitHub Actions

push branch filters and pull_request branch filters select different events; pull_request branches refer to the target branch. Configure both only when both checks are wanted.

Fragment

GitHub Actions YAML fragment; place it at the scope shown. Referenced project commands/files must exist.

.github/workflows/checks.yml
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

Separate scheduling labels from the execution image

GitHub Actions

runs-on chooses a runner. A job container is a separate choice with its own available tools and shell behavior; a runner label is not an arbitrary container image.

Fragment

GitHub Actions YAML fragment; place it at the scope shown. Referenced project commands/files must exist.

.github/workflows/checks.yml
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
jobs:
  inspect:
    runs-on: ubuntu-24.04
    steps:
      - run: uname -s

Bound job and step runtime

GitHub Actions

Use a job timeout and optionally a smaller step timeout. Cancellation is not a transactional rollback of external work already performed.

Fragment

GitHub Actions YAML fragment; place it at the scope shown. Referenced project commands/files must exist.

.github/workflows/checks.yml
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
jobs:
  test:
    runs-on: ubuntu-24.04
    timeout-minutes: 10
    steps:
      - run: sleep 1
        timeout-minutes: 1