Created
January 26, 2017 16:29
-
-
Save marknadig/3e473fac11bb1c68098f40d67c1e097f to your computer and use it in GitHub Desktop.
Poll and auto-rebuild failed TFS merge
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 poller; | |
var pollForBuild = function() { | |
// Approved yet? | |
if ($(".vc-pullrequest-merge-policy-status-item span:contains('approved')").length == 0) { | |
console.log("Poller: waiting for approval"); | |
return; | |
} | |
// build succeeded? | |
if ($(".vc-pullrequest-merge-policy-status-item a:contains('succeeded')").length) { | |
console.log("Poller: FTW!"); | |
clearTimeout(poller); | |
return; | |
} | |
// see if build sitting in expired | |
if ($(".vc-pullrequest-merge-policy-status-item a:contains('expired')").length) { | |
console.log("Poller: Retrying build..."); | |
// make sure popup is up | |
$(".vc-pullrequest-merge-policy-status-item a:contains('expired')").siblings(".action-icon").children("div").click(); | |
setTimeout(function() { | |
// click the button | |
$(".vc-pullrequest-merge-policy-status-item a:contains('expired')").siblings(".action-icon").children("ul.menu-popup").children("li").children("ul").children("li").click(); | |
}, 300); | |
} | |
} | |
poller=setInterval(pollForBuild, 60000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment