Created
March 10, 2016 12:15
-
-
Save adamelso/d90eb73c4d957ce7f943 to your computer and use it in GitHub Desktop.
Remove inactive branch environments from Platform.sh
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
var deleteBranches = function () { | |
return $("ul[ng-show='environment.active_trail']") | |
.first() | |
.find("li.disabled > div > a") | |
.map(function (i, b) { | |
return b.text; | |
}); | |
}; | |
var filterDeleteBranchesByPrefix = function (prefix) { | |
return deleteBranches().filter(function (b) { | |
return 0 === b.indexOf(prefix); | |
}); | |
}; | |
var buildBashScriptForDeletingBranches = function (branches) { | |
var sh = ""; | |
sh += "for $DELETEDBRANCH in "; | |
sh += branches.join(" "); | |
sh += "; do\n" | |
sh += "\tplatform environment:delete --environment="; | |
sh += $DELETEDBRANCH | |
sh += "\n" | |
sh += "done"; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment