Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mmorenoregalado/action-branches-cleaner
"Branches Cleaner" automatically deletes inactive and merged branches, keeping your tree organized in GitHub repos. Let it clean for you!
https://github.com/mmorenoregalado/action-branches-cleaner
action actions automation bash-script branch-management branches cleaner cleanup delete-branches github-actions purge
Last synced: about 1 month ago
JSON representation
"Branches Cleaner" automatically deletes inactive and merged branches, keeping your tree organized in GitHub repos. Let it clean for you!
- Host: GitHub
- URL: https://github.com/mmorenoregalado/action-branches-cleaner
- Owner: mmorenoregalado
- License: mit
- Created: 2023-01-11T05:30:38.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-13T02:21:57.000Z (8 months ago)
- Last Synced: 2024-09-27T01:23:28.834Z (about 2 months ago)
- Topics: action, actions, automation, bash-script, branch-management, branches, cleaner, cleanup, delete-branches, github-actions, purge
- Language: Shell
- Homepage:
- Size: 316 KB
- Stars: 43
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Branches Cleaner Github Action Upvote us in Devhunt_
This GitHub Action automatically cleans up branches in a repository, deleting closed branches without merges, merged branches, and inactive branches after a specified period in days. You can specify the base branches or protected branches that should not be deleted.
## Inputs
### `base_branches`***Required***. Comma-separated string of the base branches that you want to keep. For example: `main,develop`.
### `token`
***Required***. Token to authenticate with the GitHub API.### `days_old_threshold`
***Optional***. Number of days of inactivity to remove inactive branches. Default is `7`.## Usage
This GitHub Action can be triggered by different events offered by GitHub, depending on the needs of each team or individual. In the following example, a schedule trigger is used to run the action every day at midnight:```` yaml
name: Branches Cleaneron:
schedule:
- cron: "0 0 * * *"jobs:
cleanup-branches:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: GitHub Branch Cleaner
uses: mmorenoregalado/[email protected]
with:
base_branches: develop,master
token: ${{ secrets.GITHUB_TOKEN }}
days_old_threshold: 7````
Refer to the [official GitHub documentation](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows) for more information on the different events that can be used to
trigger GitHub Actions.## Troubleshooting
If you encounter an error with exit code 127 when running this action, it may be due to restrictions on workflow runs in your repository settings. To resolve this issue, please check if the action is allowed to run:
1. Go to your repository's settings.
2. Navigate to the "Actions" tab.
3. Under "General" settings, look for "Workflow permissions".
4. Make sure that the Read and write permissions option is selected, which allows workflows to have read and write permissions in the repository for all scopes.## Usage the latest version
To use the latest version:
1. Click on the following link http://bit.ly/3zgLxHf. This will redirect you to the official GitHub Action Page
2. Then click on `Use latest version`:
3. Finally replace the text in the GitHub Action YAML file in your .git/workflows/ folder.
With that you will have the latest version of Branches Cleaner installed.
## Contributing
This action is open to contributions. If you find any issues or bugs, feel free to open an issue or pull request.## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.