Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
play

GitHub Action

PR history in description

v1.3.7

PR history in description

play

PR history in description

Add pull request commit history to description

Installation

Copy and paste the following snippet into your .yml file.

              

- name: PR history in description

uses: Frederick888/[email protected]

Learn more about this action in Frederick888/gh-ph

Choose a version

GitHub PR History

gh-ph is a gh extension and a GitHub Action that puts commit history into your pull request description.

Install

gh extension install Frederick888/gh-ph

Dependencies

Usage

Command line

Add two === GH HISTORY FENCE === lines into your PR description. The commit history will be placed between the two fences when you run gh ph.

For example,

## Description

Super duper fantastic feature.

## Changes

<!-- === GH HISTORY FENCE === -->

<!-- === GH HISTORY FENCE === -->

GitHub Actions

First, visit your repository's Settings -> Actions -> General, and select 'Read and write permissions' in 'Workflow permissions'.

Then add the fences to your pull request templates, and finally set up a job as below:

on:
  pull_request_target:

permissions:
  contents: read
  pull-requests: write

jobs:
  gh-ph:
    name: Add commit history to pull request description
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 100
      - run: |
          git remote set-branches origin '*'
          git fetch --depth 100
      - uses: Frederick888/gh-ph@v1
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Configuration

Default history format can be configured via environment variable GH_PH_HISTORY_FORMAT (with.format in Actions).

Per template/section formats can be configured using inline format fences. For example,

# Overview
<!-- === GH HISTORY FORMAT FENCE === --> <!--
- %s
--> <!-- === GH HISTORY FORMAT FENCE === -->
<!-- === GH HISTORY FENCE === -->
<!-- === GH HISTORY FENCE === -->

# Details
<!-- === GH HISTORY FORMAT FENCE === --> <!--
### [`%h`]({{.url}}/commits/%H) %s%n%n%b%n
--> <!-- === GH HISTORY FORMAT FENCE === -->
<!-- === GH HISTORY FENCE === -->
<!-- === GH HISTORY FENCE === -->

By default it runs history format through gh format then Git pretty formats.