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.

Jobs & dependencies

Make prerequisite jobs explicit

GitHub Actions

needs names prerequisite jobs. A failed or skipped prerequisite normally skips dependent jobs unless an appropriate condition changes that behavior.

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:
  build:
    runs-on: ubuntu-24.04
    steps:
      - run: printf 'build\n'
  test:
    needs: build
    runs-on: ubuntu-24.04
    steps:
      - run: printf 'test\n'

Keep event conditions separate from shell conditions

GitHub Actions

A job/step if expression is evaluated by Actions, while a shell conditional runs on the runner. Do not paste expression data into shell source to decide what to execute.

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:
  main_only:
    if: github.event_name == 'push' && github.ref == 'refs/heads/main'
    runs-on: ubuntu-24.04
    steps:
      - run: printf 'default-branch check\n'

Expand a declared runtime matrix

GitHub Actions

A matrix creates job variants. The runtime is selected by setup-node using the matrix value; merely declaring a node dimension does not change the installed runtime.

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:
  version:
    runs-on: ubuntu-24.04
    strategy:
      fail-fast: false
      matrix:
        node: [24, 26]
    steps:
      - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1
        with:
          node-version: ${{ matrix.node }}
      - run: node --version

Preserve a failing check’s meaning

GitHub Actions

A nonzero command status fails a run step under the configured shell behavior. continue-on-error changes failure handling; it is not a repair for an unreliable mandatory check.

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
    steps:
      - run: exit 1

Run cleanup without claiming it always completes

GitHub Actions

A cleanup step with always() can run after earlier steps fail, but infrastructure loss, termination and time limits can still prevent completion. External resources need a recovery/expiry policy.

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: printf 'work\n'
      - if: always()
        run: printf 'cleanup attempt\n'