Created
October 9, 2015 15:47
-
-
Save donato/3365592ffea0141e17e1 to your computer and use it in GitHub Desktop.
Delete merged and closed branches from github which don't have recent activity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function deleteBefore(days) { | |
var ONE_DAY = 1000 * 60 * 60 * 24; | |
$('.branch-summary:not(.is-deleted)').each(function () { | |
var $this = $(this); | |
var datetime = new Date($this.find('time').attr('datetime')).getTime(); | |
var today = (new Date().getTime()); | |
var filter = today - (ONE_DAY * days); | |
if (datetime < filter) { | |
if ($this.find('.state').is('.state-merged, .state-closed')) { | |
$this.find('button.branch-delete').click(); | |
} | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Github removed jQuery from their site, this is the new version: https://github.com/donato/github-branch-cleaner