Skip to content

GitHub CLI extension to add a commit log to a pull request's body

License

Notifications You must be signed in to change notification settings

AdamVig/gh-pr-body-commits

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gh-pr-body-commits

A GitHub (gh) CLI extension to add a commit log to a pull request's body.

  • When no pull request is detected or the flag --skip-update is provided, the commit log will be printed to the console and can be piped to other commands.
  • When an existing pull request is detected, the body will be updated with the latest commit log, using the base of the pull request if a base is not provided.
  • Uses hidden markers in the pull request body to avoid overwriting any content other than the commit log.
  • Uses the repository's default branch when a base branch is not provided.
  • Supports a custom template located in .git/gh-pr-body-commits-template, replacing <commits> in the template with the generated content.

Installation

  1. Install the GitHub CLI.

  2. Install the extension.

    gh extension install AdamVig/gh-pr-body-commits

Usage

# In a GitHub repository

# To create a new pull request
gh pr-body-commits | gh pr create --body-file='-'

# To update an existing pull request
gh pr-body-commits

# With a custom base
gh pr-body-commits my-feature-branch

# Skip updating an existing pull request, print to stdout instead
gh pr-body-commits --skip-update
gh pr-body-commits my-feature-branch --skip-update

# With a custom template
# Contents of file `.git/gh-pr-body-commits-template`:
# ## Description
# <commits>
# ## Test Plan
gh pr-body-commits --skip-update
# Output:
# ## Description
# **Commits**
# - Example commit
# ## Test Plan

About

GitHub CLI extension to add a commit log to a pull request's body

Topics

Resources

License

Stars

Watchers

Forks

Languages