Skip to main content

pr-merge-audit

Merge-tests the open pull requests of a repository against its base branch and writes a Markdown report of which PRs combine cleanly, which conflict, and which break each other's tests.

No AI or network is involved after the snapshot step: the same snapshot, configuration and machine always produce the same report. The tool is not tied to any project, language or test runner; everything about the repository under test is in a configuration file kept with that project.

Requirements

  • Python 3.9 or later, standard library only.
  • git 2.38 or later (git merge-tree --write-tree).
  • Linux, macOS or Windows.
  • For snapshot only: GitHub (github.com, or GitHub Enterprise). Optional: GITHUB_TOKEN in the environment (unauthenticated API access is rate-limited). For other hosts, see Other hosts.

Install

pip install pr-merge-audit
pr-merge-audit --help

or run python3 pr_merge_audit.py from a clone; it has no dependencies and takes the same arguments.

How it works

  1. Freeze the PRs. snapshot saves every open PR's head commit, changed files, draft flag and check status, plus every commit involved, so the build can be re-run later even after branches move or are deleted.
  2. Pick the PRs to try. Drafts, PRs whose required check did not pass, PRs that change no tests, and PRs you exclude in the config are skipped, each with its reason.
  3. Merge them one by one. build merges each PR onto the base in order and runs your tests after each merge. A PR that conflicts or fails is backed out; a failure that passes on a re-run is marked flaky.
  4. Find out why. For a conflicting PR, the PRs it conflicts with are swapped out and the tests run again. For a failing PR, the merge sequence is bisected for the PR that breaks it, and that pair is tested alone on the base.
  5. Write the report. report turns the results into Markdown: what merged, what conflicted or failed and the culprit where one was found, the test runs each phase used, and how many runs landing the PRs one at a time would have needed.

The tests of every PR run as you. Run builds on a disposable machine or container that holds no credentials. See Security.

Commands

pr-merge-audit --config CONFIG snapshot                        freeze PR heads and metadata (GitHub)
pr-merge-audit --config CONFIG build --snapshot FILE           merge-test offline, write results
      [--emit-branch REF --emit-repo PATH]                     also keep the merged build as a branch
      [--ignore-status] [--out FILE]
      [--merge-only]                                           only merge: no tests, no PR code run
pr-merge-audit report --results FILE [--out FILE]              render the Markdown report
pr-merge-audit verify --results FILE [--golden FILE]           check the report renders the same
pr-merge-audit --config CONFIG estimate --snapshot FILE --reference FILE   rough running time here

See Commands for what each one does.

Quick start

pip install pr-merge-audit
mkdir myproject && cd myproject
curl -so config.json https://raw.githubusercontent.com/jacob-adm/pr-merge-audit/main/config.example.json
# edit config.json: repo, remote, base and test_cmd (see Configuration)
pr-merge-audit --config config.json snapshot
pr-merge-audit --config config.json build --snapshot snapshots/DATE.json
pr-merge-audit report --results results/DATE.json --out reports/DATE.md

To see only which PRs conflict, without running any PR's code, add --merge-only to build. It needs no test_cmd and tries every open PR, so it is a safe first run on a repository.

DATE is the UTC date of the snapshot. Paths are relative to the current directory, so keep each project's config, snapshots and results in a directory of its own.

Documentation

  • How it works: each step of the build, and what makes it deterministic.
  • Commands: each command, snapshots from other hosts, and keeping the merged build as a branch.
  • Configuration: every config key, and probes.
  • Timings: what a build costs in test runs, estimating it, the serial-landing comparison and a measured build.
  • Security: what runs as you, and what the tool does to limit damage.
  • Testing: the test suite and the golden-report self-check.
  • Using it with other tools: landing a batch with git-overlap first and git surface on the kept branch.
  • Contributing: how the project is developed and what is enforced.
  • Reporting a vulnerability

License

Apache License 2.0; see LICENSE.

Metadata

Release files for pr-merge-audit 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pr-merge-audit 1.4.0
File Size Uploaded Provenance Actions
pr_merge_audit-1.4.0.tar.gz 70.0 kB With provenance Details for pr_merge_audit-1.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pr-merge-audit 1.4.0
File Interpreter ABI Platform Actions
pr_merge_audit-1.4.0-py3-none-any.whl Python 3 none any Details for pr_merge_audit-1.4.0-py3-none-any.whl

Total release size: 105.5 kB

Release files / pr_merge_audit-1.4.0.tar.gz

Download URL pr_merge_audit-1.4.0.tar.gz
Size 70.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9dfdd1cccfb11d3b99c926254d4fd7152ec3cd3d8f5ca297c6841713c4fab6f5
BLAKE2b-256 checksum
How to use checksums
180edc1c400281b2d780657c9f23133f243a0fd457ac443265e5ccf1a9c08382
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Release files / pr_merge_audit-1.4.0-py3-none-any.whl

Download URL pr_merge_audit-1.4.0-py3-none-any.whl
Size 35.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8dc593d6f0af3c1d3c7cd114513a5702bc8c876c9253cdbe87b71c241021d9d1
BLAKE2b-256 checksum
How to use checksums
ab6cc3a4b55e7cb905e2da9ba763d191e7bc898e7fd132f1d2ee5d20d0c93ab2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Security for pr-merge-audit 1.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pr_merge_audit-1.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page