A command-line to create a pull request to review the entire content of a Github repository.

Pull Request Me

Pull Request Me (PRMe) creates a pull request for the entire content of a Github repository. This is useful to solicit review comments on an entire project. Note that any changes made within the pull request branch will require manual intervention to merge back into a repository default branch.

Usage

Note this has not yet been tested on Windows!

One-time Setup

  • Set the GH_TOKEN environment variable to a Github personal access token that has the repo scope; permission.
    • Note that the repo scope allows access to any repository that is available to your Github account - Github currently does not have a more granular repository permission available.
  • Have Git installed.
    • Be sure Github SSH access to clone and push repositories works correctly, using URLs of the form ssh://[email protected]/....
  • Install this pr-me tool by either:
    • Run go install github.com/ivanfetch/prme/cmd/prme@latest
    • Directly downloading a release
    • Building from source, after downloading or cloning this repository, by running make build

Example

$ ./prme UserName/RepositoryName
A full pull request has been created at https://github.com/UserName/RepositoryName/pulls/1
  • If you intend to commit changes as part of the review process of this pull request, do one of the following:
    • Commit to your default (typically main or master) branch, then merge that branch back into the head branch of the pull request (by default prme-full-content.
    • Commit changes to the pull request head branch (by default prme-full-content), but be sure to manually merge that branch back into your default branch before closing the pull request.

Run ./prme -h for additional options, including the default repository branch, pull request title and body (first comment), and names to be used for the pull request branches.

How It Works

PR-me creates an orphaned branch with no commit history, as the base for a pull request. This allows the pull request to include all content present on the default branch of the repository (typically main or master). Such a pull request does not merge changes back into the default branch of the repository - that requires manual intervention.

This utility performs these steps to accomplish the above:

  • Use the git command to clone the repository via SSH, and create two orphan branches as the base and head branches for the pull request. Remaining steps will use the Github API instead of the local git command.
  • Merge the default branch (typically main or master) into the head pull request branch.
  • Create a pull request using the empty orphan base branch, and the head branch which contains the same content and commits as the default branch.

Design Considerations

Using Git

The git command is used in one area where the Github API cannot be used - creating an orphan branch with no files in the repository.

Unfortunately the Github API to create a commit does not support reliably creating a commit pointing at the git empty-tree. The Github API call often returns an HTTP 500, with no HTTP body.

Github technical support responded that this specific (empty-tree) operation should never succeed, and that the 500 error is expected.

Here is an example command to create a commit for the empty-tree, using the Github API:

curl -v \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GH_TOKEN}" \
https://api.github.com/repos/UserName/TestRepo/git/commits \
-d '{"message":"empty tree commit","tree":"4b825dc642cb6eb9a060e54bf8d69288fbee4904"}'

Changes Made During The Pull Request

Unfortunately, the base branch for the pull request can not be the repository default branch (main or master). This means any commits made during the pull request review must be made in a non-standard way.

  • Commit to the default branch, but merge that into the pull request head branch.
  • Make commits to the pull request head branch, but remember to merge that branch into the default branch before the head branch is deleted (which some repositories are configured to do automatically).

I'm still determining how to describe this behavior succinctly within the prme tool.

Owner
Ivan Fetch
I'm traveling, working remotely, and using technology to help people do their best work.
Ivan Fetch
Similar Resources

git-xargs is a command-line tool (CLI) for making updates across multiple GitHub repositories with a single command

git-xargs is a command-line tool (CLI) for making updates across multiple GitHub repositories with a single command

git-xargs is a command-line tool (CLI) for making updates across multiple GitHub repositories with a single command. You give git-xargs:

Feb 5, 2022

An open-source GitLab command line tool bringing GitLab's cool features to your command line

An open-source GitLab command line tool bringing GitLab's cool features to your command line

GLab is an open source GitLab CLI tool bringing GitLab to your terminal next to where you are already working with git and your code without switching

Dec 30, 2022

A command line tool that builds and (re)starts your web application everytime you save a Go or template fileA command line tool that builds and (re)starts your web application everytime you save a Go or template file

# Fresh Fresh is a command line tool that builds and (re)starts your web application everytime you save a Go or template file. If the web framework yo

Nov 22, 2021

A command line tool to prompt for a value to be included in another command line.

readval is a command line tool which is designed for one specific purpose—to prompt for a value to be included in another command line. readval prints

Dec 22, 2021

GitHub’s official command line tool

GitHub’s official command line tool

GitHub CLI gh is GitHub on the command line. It brings pull requests, issues, and other GitHub concepts to the terminal next to where you are already

Jan 7, 2023

github stats from the command line

github stats from the command line

Retrieve GitHub statistics per username from the command line: no need to open the browser anymore!

Sep 8, 2022

GitHub on the command line with golang

GitHub on the command line with golang

GitHub CLI gh is GitHub on the command line. It brings pull requests, issues, and other GitHub concepts to the terminal next to where you are already

Dec 31, 2021

Simple command line Github Search

ghs is a simple command line tool which will open the corresponding url for your github search in your default web browser.

Nov 10, 2021

gh is GitHub on the command line

gh is GitHub on the command line

gh is GitHub on the command line. It brings pull requests, issues, and other GitHub concepts to the terminal next to where you are already working with git and your code.

Nov 10, 2021
Related tags
Github cli extension to approve or reject pending deployments that are waiting for review.

gh-deploy A gh cli extension to approve or reject pending deployments that are waiting for review. Installation Installation requires a minimum versio

Nov 2, 2022
A simple single-file executable to pull a git-ssh repository and serve the web app found to a self-contained browser window

go-git-serve A simple single-file executable to pull a git-ssh repository (using go-git library) and serve the web app found to a self-contained brows

Jan 19, 2022
A twitch focused command line tool for producing, archiving and managing live stream content. Built for Linux.

twinx is a live-streaming command line tool for Linux. It connects streaming services (like Twitch, OBS and YouTube) together via a common title and description.

Oct 17, 2022
Command line XML beautifier and content extractor. Similar to jq.
Command line XML beautifier and content extractor. Similar to jq.

Command line XML beautifier and content extractor. Similar to jq.

Dec 25, 2022
Emlparsingtool - A command line tool that extracts attachments and content directly

A command line tool that extracts attachments and content directly from emL file format messages

Sep 6, 2022
Package command provide simple API to create modern command-line interface

Package command Package command provide simple API to create modern command-line interface, mainly for lightweight usage, inspired by cobra Usage pack

Jan 16, 2022
zipspy - a CLI tool to extract files from zip archives in S3 without needing to download the entire archive

Zipspy allows you interact with ZIP archives stored in remote locations without requiring a local copy. For example, you can list the filenames in an S3 ZIP archive, download a subset of files, search and retrieve files with regular expressions, and more!

Feb 19, 2022
A tool to sent comments to Issues or Pull Requests in Github from CI tools.

CommentCI A tool to sent comments to Issues or Pull Requests in Github from CI tools. Usage Required environment variables: GITHUB_COMMENT_USER - User

Apr 10, 2022
Go terminal app listing open pull requests in chosen GitHub repositories
Go terminal app listing open pull requests in chosen GitHub repositories

go-pr-watcher About Shows open pull requests on configured GitHub repositories. Getting started Create GitHub personal token with read permissions Cre

Aug 23, 2022
git-xargs is a command-line tool (CLI) for making updates across multiple Github repositories with a single command.
git-xargs is a command-line tool (CLI) for making updates across multiple Github repositories with a single command.

Table of contents Introduction Reference Contributing Introduction Overview git-xargs is a command-line tool (CLI) for making updates across multiple

Dec 31, 2022