A GitHub app built that automatically deletes a branch after it's merged. That's it, enjoy!
npm install delete-merged-branch
_Want to run this app with GitHub Actions? Click here_
A GitHub app built with Probot that automatically deletes a branch after it's merged. That's it, enjoy!
2. Then, clone the repo:
``sh`
git clone git@github.com:SvanBoxel/delete-merged-branch.git
3. Copy .env.example to .env and set the right environment variables as here
4. Now, install app dependencies and run it:
`shInstall dependencies
npm install
Running with Docker
1. Make sure you have docker installed.
2. Follow the same steps as running locally to set up the GitHub app and
environment files.
3. Build the docker image:
`sh
docker build -t delete-merged-branch .
`4. Run the docker image:
`sh
docker run -i -t --rm \
-v "$(pwd)/.env:/app/.env" \
-p 3000:3000 \
delete-merged-branch
`Alternate Example: Running test in the docker image
`sh
docker run -i -t --rm \
-v "$(pwd)/.env:/app/.env" \
-v "$(pwd)/sample-data:/sample-data" \
delete-merged-branch \
receive /app/index.js -p /sample-data/event.json
`How it works
This GitHub app listens to the pull_request.closed webhook. If a pull request is closed and the connected branch is merged, it will delete the branch.Configuration
The optional app configuration YAML file should be saved as .github/delete-merged-branch-config.yml. At the moment it supports the following options:-
exclude _(array)_ - list of branches that should not be automatically deleted after a merge. Wildcards supported.
- delete_closed_pr _(bool)_ whether or not a branch should be deleted if PR is closed without mergingExample
.github/delete-merged-branch-config.yml:`
exclude:
- development
- qa
- feature-*
delete_closed_pr: true
`Release process
CI (Travis) is in charge of releasing new versions of the GitHub Application to Now. On every new commit to master we run semantic-release to determine whether the major/minor/patch version should be incremented. If so, we update the version running in production.Running in GitHub actions
This app is compatible with GitHub Actions. You need to create a workflow that is triggered on the pull_request event for this. Then, you use this repo for the action. (SvanBoxel/delete-merged-branch@master). Don't forget to check the GITHUB_TOKEN` secret. That's it.If you have suggestions for how this GitHub app could be improved, or want to report a bug, open an issue! We'd love all and any contributions.
For more, check out the Contributing Guide.
ISC © 2018 Sebass van Boxel