Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pcvg/remove-merged-branches
Remove the branches that were merged in the branch in which you run this action.
https://github.com/pcvg/remove-merged-branches
branch branches branches-workflow ci continuous-integration github-actions
Last synced: 2 days ago
JSON representation
Remove the branches that were merged in the branch in which you run this action.
- Host: GitHub
- URL: https://github.com/pcvg/remove-merged-branches
- Owner: pcvg
- Created: 2021-03-08T16:41:44.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-04-21T19:23:02.000Z (over 3 years ago)
- Last Synced: 2024-11-05T20:17:18.482Z (about 2 months ago)
- Topics: branch, branches, branches-workflow, ci, continuous-integration, github-actions
- Language: Shell
- Homepage:
- Size: 23.4 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Remove merged branches
Remove the branches that were merged in the branch in which you run this action.
## :warning: Warning
- __Do you really need this?__ GitHub can also delete branches automatically after PR has been merged. See [managing the automatic deletion of branches](https://docs.github.com/en/github/administering-a-repository/managing-the-automatic-deletion-of-branches). This Action is useful when your workflow does not merge changes (after PR) against your default branch directly.
- __This action WILL delete branches!__ Please do your due diligence before using this tool. The provider of this software will not take liability over any mishaps that may occur.## :gear: How does it work?
1. Using `git`, all merged branches in the current branch (`$GITHUB_ACTION_REF`) are fetched
2. Branches are removed, except for:
- current branch
- the branches added to the ignore list
3. Message is logged for each branch that is removed or ignored__ATTENTION__: some branches are ignored by default, see [considerations](#considerations).
## :rocket: Running in GitHub Actions
Run this action in Github Actions by adding `pcvg/remove-merged-branches@main` to your steps.
### Parameters
| Name | Meaning | Default | Required |
| --- | --- | --- | --- |
| `protected_branch` | Branch that will be ignored in the removal process | - | false |### Example
In the below example all branches merged to `main` will be removed:
```yml
name: Remove merged branches
on:
push:
branches:
- mainjobs:
remove-branches:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Remove branches
uses: pcvg/remove-merged-branches@main
with:
protected_branch: some-branch
```### Considerations
- Any branch that is a copy of the default branch (without any diff) will also be removed
- Following branches will be ignored and not removed by default:
- `main`
- `staging`
- `production`
- `master`## ⚖️ License
This project is licensed under the GPL-3.0 License - see the [LICENSE](LICENSE) file for details.