Skip to content

Instantly share code, notes, and snippets.

@adamelso
Created March 10, 2016 12:15
Show Gist options
  • Save adamelso/d90eb73c4d957ce7f943 to your computer and use it in GitHub Desktop.
Save adamelso/d90eb73c4d957ce7f943 to your computer and use it in GitHub Desktop.
Remove inactive branch environments from Platform.sh
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