Use BranchPy in CI to catch regressions before merge.
Typical CI flow
- Install Python and BranchPy.
- Run Doctor as an environment sanity check.
- Run Analyze and/or Stats in JSON mode.
- Fail the build if blocking issues are detected.
Example (GitHub Actions)
name: branchpy-check
on:
pull_request:
push:
branches: [ main ]
jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install BranchPy
run: pip install branchpy
- name: Doctor
run: branchpy doctor --project . --json
- name: Analyze
run: branchpy --project . analyze --format json
- name: Stats
run: branchpy --project . stats --format json
Recommended flags for automation
--project <path>for deterministic scope.--jsonor--format jsonfor machine-readable output.--quietfor lower-noise logs where needed.
Practical notes
- Keep CI and local workflows aligned to reduce “works on my machine” drift.
- Pin Python version in CI.
- If your repo has multiple projects, run BranchPy once per target path.