https://github.com/kt3k/update-pr-description
Update Pull Request Description on Push
https://github.com/kt3k/update-pr-description
github-actions pull-request
Last synced: 11 months ago
JSON representation
Update Pull Request Description on Push
- Host: GitHub
- URL: https://github.com/kt3k/update-pr-description
- Owner: kt3k
- License: apache-2.0
- Created: 2019-11-05T10:17:13.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-02-14T23:31:49.000Z (about 1 year ago)
- Last Synced: 2025-04-04T03:35:36.490Z (11 months ago)
- Topics: github-actions, pull-request
- Language: JavaScript
- Homepage:
- Size: 1.12 MB
- Stars: 21
- Watchers: 3
- Forks: 14
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Update Pull Request Description on Push
This github action updates the description (and/or title) of the PR by the given source and destination branches.
# Usage
This action doesn't create a PR, but updates it. We recommend you should use this github action with [repo-sync/pull-request][]
```yml
name: Creates and Updates PR
on:
push:
branches:
- some-branch
jobs:
pull-request:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: pull-request
uses: repo-sync/pull-request@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: update-pull-request
uses: kt3k/update-pr-description@v2
with:
pr_body: "**some description**"
github_token: ${{ secrets.GITHUB_TOKEN }}
```
[repo-sync/pull-request][] creates a PR, but the action doesn't update it if the PR already exists. If you need to update the description of the PR on each push, you can use this action for it.
## Our use case
We creates a pull request from `master` to `release` and update the description on each push on `master`. Merging to release branch causes the actual release to the staging environment. So this github workflow works as the release preparation and we can see what is going to be released at the next release by seeing this pull request.
```yml
name: Creates and Updates PR
on:
push:
branches:
- master
jobs:
pull-request:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: create-description
run: "some script for creating PR description from the branch diff"
id: description
- name: pull-request
uses: repo-sync/pull-request@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
destination_branch: release
pr_title: Release
- name: update-pull-request
uses: kt3k/update-pr-description@v2
with:
pr_body: ${{ steps.description.outputs.description }}
destination_branch: release
github_token: ${{ secrets.GITHUB_TOKEN }}
```
# Parameters
## Inputs
### `github_token`
The GITHUB_TOKEN secret. This is required.
### `pr_title`
The title of the PR. Optional.
### `pr_body`
The body of the PR
### `destination_branch`
Base branch of the PR. Default is master.
### `fail_on_error`
Option to mark the job as failed in case there are errors during the action execution. Default is 'true'.
## Outputs
This action has no outputs.
# LICENSE
Apache License, Version 2.0
[repo-sync/pull-request]: https://github.com/repo-sync/pull-request