1
0
Fork 0
mirror of https://github.com/Luzifer/clean-github-branches.git synced 2024-12-22 02:11:19 +00:00
Tooling to clean up branches in Github repositories
Find a file
2018-09-07 12:10:18 +02:00
vendor Log branch age 2018-09-07 12:06:53 +02:00
.gitignore Initial version 2018-09-07 11:36:23 +02:00
.repo-runner.yaml Add automated building 2018-09-07 11:41:00 +02:00
Gopkg.lock Log branch age 2018-09-07 12:06:53 +02:00
Gopkg.toml Log branch age 2018-09-07 12:06:53 +02:00
History.md prepare release v0.1.0 2018-09-07 12:10:18 +02:00
LICENSE Add META 2018-09-07 11:54:11 +02:00
main.go Log branch age 2018-09-07 12:06:53 +02:00
Makefile Add automated building 2018-09-07 11:41:00 +02:00
README.md Log branch age 2018-09-07 12:06:53 +02:00

Go Report Card

Luzifer / clean-github-branches

This tool is intended to clean up branches in repositories having many contributors with several pull-requests: Most of the time people tend to forget to delete the branch after merging the pull-request and branches pile up. Running clean-github-branches against the repo will find

  • branches whose corresponding pull-requests are merged and delete them
  • branches not being ahead of the base branch and delete them after a configurable duration
  • branches being stale and optionally delete them after a configurable duration

Usage

$ clean-github-branches --help
Usage of clean-github-branches:
      --branch-staleness duration   When to see a branch as stale (default 90d) (default 2160h0m0s)
      --delete-stale                Delete branches after branch-staleness even if ahead of base
  -n, --dry-run                     Do a dry-run (take no destructive action) (default true)
      --even-timeout duration       When to delete a branch which is not ahead of base (default 24h0m0s)
      --listen string               Port/IP to listen on (default ":3000")
      --log-level string            Log level (debug, info, warn, error, fatal) (default "info")
      --process-limit int           How many repos to process concurrently (default 10)
  -r, --repo-regex string           Regular expression the full repo (user/reponame) must match against
      --token string                Token to access Github API
      --version                     Prints current version and exits

$ clean-github-branches -r '^[lL]uzifer(-docker|-ansible|)/'
WARN[0012] Stale branch found                            age=2y174d23h ahead=1 behind=1 branch=develop dry-run=true repo=luzifer-docker/etherpad-lite
INFO[0012] Done.

All parameters causing destructive actions are set to sane defaults: By default a dry-run is done which prevents any deletion. Also delete-stale is disabled as it might cause data loss as the branch is not merged and all commits in it will be lost.