Delete merged and stale branches from a Github repository.
See example Preview and Cleanup step.
You need to use Python 3.6+ and declare it before
uses: actions/setup-python@v2 with: python-version: '3.x' architecture: 'x64'
- This deletes branches that fulfil either of these:
- Merged into Master or Main (specified by
which_master_main
) OR - Branches older than X days (specified by
delete_stale_after_days
)
- Merged into Master or Main (specified by
This by default does not actually delete until you set parameter action = cleanup
- The following branches are not deleted by default:
- main
- develop
- master
WARNING: When you delete branches with no active PR, you will lose access to the ability to restore the branch. Please back it up using Github Artifacts or a copy of the branch prior to running this.
Read the Python Readme . PyPi version available for PIP.
Based off git-sweep .
MIT License.