Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jessfraz/branch-cleanup-action
A GitHub action to automatically delete the branch after a pull request has been merged.
https://github.com/jessfraz/branch-cleanup-action
Last synced: 13 days ago
JSON representation
A GitHub action to automatically delete the branch after a pull request has been merged.
- Host: GitHub
- URL: https://github.com/jessfraz/branch-cleanup-action
- Owner: jessfraz
- License: mit
- Created: 2018-11-20T18:26:09.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-03-02T13:52:50.000Z (over 2 years ago)
- Last Synced: 2024-10-22T03:17:07.710Z (21 days ago)
- Language: Shell
- Size: 659 KB
- Stars: 424
- Watchers: 10
- Forks: 59
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-list - branch-cleanup-action
README
# Branch Cleanup Action
[![Travis CI](https://img.shields.io/travis/jessfraz/branch-cleanup-action.svg?style=for-the-badge)](https://travis-ci.org/jessfraz/branch-cleanup-action)
A GitHub action to automatically delete the branch after a pull request has been merged. Here's [a blog post](https://blog.jessfraz.com/post/the-life-of-a-github-action/) describing this action in more detail.
> **NOTE:** This will **never** delete the repository's default branch or protected branches. If the pull request is closed _without_ merging, it will **not** delete it.
**Table of Contents**
- [Usage](#usage)
- [Contributing](#contributing)
* [Running the tests](#running-the-tests)## Usage
```
workflow "on pull request merge, delete the branch" {
on = "pull_request"
resolves = ["branch cleanup"]
}action "branch cleanup" {
uses = "jessfraz/branch-cleanup-action@master"
secrets = ["GITHUB_TOKEN"]
}
```If you include this in another Workflow, you may want to configure the environment variable `NO_BRANCH_DELETED_EXIT_CODE`. The default value for this is `78`, as Github Actions will mark a check as "neutral" (neither failed/succeeded) when you exit with code 78. This will however **cancel** any other actions running in parallel in this workflow.
If you don't want it to cancel, configure your workflow as follows:
```
action "branch cleanup" {
uses = "jessfraz/branch-cleanup-action@master"
secrets = ["GITHUB_TOKEN"]env = {
NO_BRANCH_DELETED_EXIT_CODE = "0"
}
}
```![demo](demo.png)
## Contributing
### Running the tests
The tests use [shellcheck](https://github.com/koalaman/shellcheck). You don't need to install anything (assuming you have [docker](https://www.docker.com) installed). The tests run in a container.
```console
$ make test
```