MergeSpan
MergeSpan is a GitHub App merge queue for one repository and one target branch. A non-draft pull request enters the queue by carrying the configured label (the default is queue). MergeSpan creates a temporary branch from the current base commit plus the pull request’s head, runs the repository’s configured checks against that exact candidate commit, and then squash-merges the pull request when the candidate is green and the base has not moved.
This page is the book landing page. Start with the Quick Start, or read How It Works for the full state machine.
Why merge queues exist
A merge queue exists to answer a question the branch protection UI cannot answer on its own: will this change pass the repository’s checks once it sits on top of every other change that was merged after the pull request was opened?
Without a queue, a pull request’s checks run against an old base. Two pull requests can each be green in isolation and then fail when both land. Common mitigations are heavy: enable strict up-to-date checks, merge serially by hand, or ask contributors to rebase and rerun until the base stops moving. MergeSpan’s job is to make that serialization automatic and evidence-based.
What MergeSpan does in one sentence
For a single base branch, MergeSpan builds the candidate commit (base tip + pull request head), waits for the configured checks on that candidate’s SHA, and squash-merges only if the candidate is green and the base has not moved.
Design constraints (v0.1)
v0.1 is deliberately narrow:
- One repository, one base branch. Multiple target branches in one installation are out of scope. Separate repositories and branches get separate queues.
- Squash merge only. There is no merge-method setting in v0.1.
- No batching. One pull request is verified at a time; there is no merge batch or speculative batch validation.
- No speculative parallel candidates. MergeSpan does not build speculative candidates for multiple queued pull requests in parallel; it serializes.
- No fork pull requests. With
same_repo_only = true(required by the v0.1 runtime), only same-repository heads are admitted. Fork heads are not queued. - No workflow writes. The App does not request the Workflows permission; it does not modify repository workflow files.
- No Administration permission. MergeSpan does not request or use Administration.
Status and release
v0.1 is early software. The release workflow builds and publishes tagged artifacts, but no tagged release has been published yet. Until a tag exists, pin a commit SHA for non-production deployments. Both production Workers must wait for a release tag. See Versions and Upgrades for the release, upgrade, and rollback policy.
Documentation set
- Quick Start — install the App, configure the repository, queue a pull request.
- How It Works — the full pipeline, failure surfaces, recovery.
- Configuration — every key, type, default, and exact error in
.github/mergespan.toml. - GitHub App — required and optional permissions, event subscriptions, webhook contract.
- Self-Hosting — Workers, ingress-only Worker, native systemd, and Docker.
- Console — the dashboard surface: login, per-repository view, Reconcile, diagnostics, manual controls.
- Migrate from Mergify — what maps, what to retire, and how to roll back.
- Comparison — MergeSpan vs Mergify vs GitHub’s native merge queue.
- Versions and Upgrades — release procedure, artifacts, build identity, upgrades, rollback, and backups.
- Sandbox Notes — the historical deployment record: prerequisites, App contract, repository configuration, ruleset, and validation steps.
Source map
| Concern | Path |
|---|---|
| Configuration parser and defaults | crates/core/src/config.rs |
| Queue reducer (candidate, checks, merge) | crates/core/src/machine.rs |
| Durable coordinator (outbox, reconciliation) | crates/engine/src/coordinator.rs |
| GitHub API client and webhook models | crates/github/src/ |
| Cloudflare Worker runtime | runtimes/cloudflare/src/ |
| Ingress-only Worker | runtimes/cloudflare-ingress/src/index.mjs |
| Native runtime (systemd/Docker) | runtimes/native/src/ |
| Static console assets | web/ |
| Deployment templates | deploy/ |
| Release workflow and shared checks | .github/workflows/release.yml, .github/actions/ci-build/ |
| Repository skills | skills/mergespan-pr/SKILL.md, skills/mergespan-usage/SKILL.md |
Build the site locally
The documentation site is built with mdBook and Python 3:
./site/build.sh
The output is written to _site/; dist/ remains reserved for release artifacts. Preview the complete site with Python’s built-in server:
python3 -m http.server 8000 --directory _site
Open http://localhost:8000/ for the landing page and http://localhost:8000/docs/ for the handbook. The build includes link and Markdown checks.