-
Notifications
You must be signed in to change notification settings - Fork 1
/
AutoRebuild.js
29 lines (26 loc) · 923 Bytes
/
AutoRebuild.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var poller;
var pollForBuild = function() {
// Approved yet? (bowtie-check == checkmark - all good)
if ($(".vc-pullrequest-merge-policy-status-item i.bowtie-check").siblings("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
$("div.popup-menu-trigger").click();
setTimeout(function() {
// click the button
$("li[title='Rebuild']").click();
}, 300);
}
}
poller=setInterval(pollForBuild, 60000);
pollForBuild();