# Several pipelines in one repository

> Split a repository's CI into several files, and know which checks each one reports and which to require.
> **Available** in repositories branchd reads pipeline files for. It is switching repositories on one at a time: until yours is, it keeps running its `.forge-ci.yaml` or `.xeonr-ci.yaml`. See [What is available](https://docs.branchd.run/branchd/pipelines#what-is-available).

```yaml title=".branchd/pipelines/ci.yaml"
# .branchd/pipelines/ci.yaml
# Checks: "CI / test" and "CI / lint" on every push and pull request.
name: CI
on: [push, pull_request]
jobs:
  test:
    image: golang:1.26
    steps:
      - run: go test ./...
  lint:
    image: golangci/golangci-lint:v2.1
    steps:
      - run: golangci-lint run
```

```yaml title=".branchd/pipelines/release.yaml"
# .branchd/pipelines/release.yaml
# Checks: "Release / binaries" on tags v1.2.3 and the like only.
name: Release
on:
  push:
    tags: ['v*']
jobs:
  binaries:
    image: golang:1.26
    steps:
      - run: GOOS=linux GOARCH=amd64 go build -o dist/app-linux-amd64 ./cmd/app
      - run: GOOS=darwin GOARCH=arm64 go build -o dist/app-darwin-arm64 ./cmd/app
    artifacts: [dist]
```

```yaml title=".branchd/pipelines/docs.yaml"
# .branchd/pipelines/docs.yaml
# Checks: "Docs / build", only when docs/ changes.
name: Docs
on:
  push:
    paths: ['docs/**']
  pull_request:
    paths: ['docs/**']
jobs:
  build:
    image: node:24
    steps:
      - run: npx --yes markdownlint-cli2 'docs/**/*.md'
```

- **One file, one pipeline, one run.** For each event, every file whose `on:`
  matches gets a run of its own. A file that does not match has no run, and
  `plan` notes why.
- **Each file is compiled on its own.** A file with a mistake is refused, with
  its own error, and the others still run.
- **Names.** A pipeline's name is its `name:`, else the file name without
  `.yaml`; 1 to 64 characters with no `/`. Two files with one name are refused.
- **Checks** are named `<pipeline> / <job>`, the job as the file names it:
  `CI / test`, `Release / binaries`, `Docs / build`. A matrix cell adds its
  values: `CI / test (1.26)`, `CI / cell (1, x)`. A job of a called pipeline
  adds the calling job: `CI / deploy / apply`. A part of a job with an
  isolated step is `CI / build [1/2]`. A pipeline named exactly `ci` has bare
  check names (`test`), as the old files' did, unless the name holds `/`
  (`ci / lib / prep`).
- **No needs across files.** A job needs only jobs of its own file. To share
  work, use a [reusable pipeline](https://docs.branchd.run/branchd/pipelines/reusable-pipelines).

## Required checks

A branch rule can require checks before a pull request merges. A required
check that a pull request's run never reports keeps the pull request from
merging, and branchd names it as missing. So require only checks that run on
**every** pull request to that branch:

- require `CI / test` and `CI / lint`, whose pipeline runs on every pull
  request;
- do not require `Docs / build` (filtered by `paths:`) or any job whose `if:`
  can be false on a pull request;
- renaming a pipeline or a job renames its check: change the rule with it.

Source: https://docs.branchd.run/branchd/pipelines/several-pipelines
