rnorth / gh-combine-prs

A `gh` extension for combining multiple PRs (e.g. Dependabot PRs) into one.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gh-combine-prs

This is an extension for GitHub CLI that combines multiple PRs into one. It is intended for use in repositories that receive many PRs that can be merged simultaneously, e.g. trivial Dependabot version bump PRs.

The tool will attempt to create one PR that contains all PRs that:

  • match a provided query - e.g. --query "author:app/dependabot" so that only Dependabot PRs are processed
  • and have checks passing
  • and that can be merged cleanly - e.g. if two combinable PRs conflict with one another, only one will be merged.

This tool does not automerge into the master/main branch - it just attempts to create one unified PR for review and automated checks to run against.

Note: When you merge the combined PR, it is recommended that you create a Merge Commit. This allows GitHub to automatically detect that all of the original combined PRs have been merged, so that their state can be set correctly.

Installation

Prerequisites:

  • GitHub CLI is already installed and authenticated
  • jq is installed

To install this extension:

gh extension install rnorth/gh-combine-prs

Usage

cd $DIRECTORY_OF_YOUR_REPO

gh combine-prs --query "QUERY"

Required arguments

--query "QUERY"
        sets the query used to find combinable PRs.
        e.g. --query "author:app/dependabot"
        to combine Dependabot PRs

Optional arguments

--selected-pr-numbers COMMA,SEPARATED,LIST
        if set, will only work on PRs with the selected numbers.
        e.g. --selected-pr-numbers 42,13,78
        Defaults to selecting every PR matching the QUERY
--limit LIMIT
        sets the maximum number of PRs that will be combined.
        Defaults to 50
--skip-pr-check
        if set, will combine matching PRs even if they are not passing checks.
        Defaults to false when not specified

License

See LICENSE

About

A `gh` extension for combining multiple PRs (e.g. Dependabot PRs) into one.

License:Apache License 2.0


Languages

Language:Shell 100.0%