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]
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

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.3.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.3.0
File Size Uploaded Provenance Actions
pr_merge_audit-1.3.0.tar.gz 67.7 kB With provenance Details for pr_merge_audit-1.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 102.4 kB

Release files / pr_merge_audit-1.3.0.tar.gz

Download URL pr_merge_audit-1.3.0.tar.gz
Size 67.7 kB
Tags Source
SHA-256 checksum
How to use checksums
972c6dbd2ad3a3b5741c508bc99f18eef80ca5983bf3f02ac88af41c5086b856
BLAKE2b-256 checksum
How to use checksums
4dfb897d1109ff8840222f46e952375a7e17331771f72925c452a245491a5228
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 19, 2026.

Transparency log

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

Download URL pr_merge_audit-1.3.0-py3-none-any.whl
Size 34.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
954bb5c413b392ffbb541e2f1019c8c7c66e0956eea1531799ffabb6e4021b07
BLAKE2b-256 checksum
How to use checksums
ccb4491b019b8be3a334d77db12f2746b7fb0956176335c88d98bd62ae146ea1
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 19, 2026.

Transparency log

Security for pr-merge-audit 1.3.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.3.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 19, 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