Delete merged branch
Want to see more badges? Click here!
A GitHub app built with Probot that automatically deletes a branch after it's merged. That's it, enjoy!
Running it locally
First, follow these instructions for making your own GitHub app. Give your app the following permissions:
- Repository contents: Read & Write.
- Pull requests: Read
Then, clone the repo:
git clone email@example.com:SvanBoxel/delete-merged-branch.git
.envand set the right environment variables as here
Now, install app dependencies and run it:
# Install dependencies npm install # Run the bot npm start
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.
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.
exclude: - development - qa
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.