This is a simple GitHub App that will attempt to update the head of a pull request branch as commits are pushed to the default branch of the repository. This is useful for keeping pull requests up to date with the default branch.
Make sure you have Go installed and configured. You can find instructions here.
Clone the repository to your local machine. Install the dependencies by running go mod tidy
in the root of the pull-request-updater
foler.
Create a GitHub App in your Organization or User settings. You can find instructions here.
The app will need the following permissions:
Permission | Access |
---|---|
Pull requests | Read & Write |
Content | Read & Write |
Subscribe to the following events:
Push
In your GitHub App settings, generate a private key. You can find instructions here.
In your GitHub App settings, add a webhook and webhook secret. You can find instructions here.
Example webhook URL: http://<ip>:<port>/api/github/hook
In the config.yml
file, update the app_id
, wehook secret
and private_key
fields with the values from your GitHub App. Update the URL field with the URL of your GitHub Enterprise instance.
For the app_configuration
field, you can specify the pull_request_preamble
which will be added to the PR comment when the PR is updated. You can also specify the pull_request_labels
which will filter the PRs that the app will update. If you do not specify any labels, the app will update all Open PRs.
Start the app by running go run pull-updater.go
. You can also build the app by running go build
and then running the executable.