Skip to content

Instantly share code, notes, and snippets.

@rgolangh
Last active April 13, 2016 06:38
Show Gist options
  • Save rgolangh/2309c1c058e6ec6e6f908b8b431e31c7 to your computer and use it in GitHub Desktop.
Save rgolangh/2309c1c058e6ec6e6f908b8b431e31c7 to your computer and use it in GitHub Desktop.
Gerrit Rerun Hook greasemonkey script
// ==UserScript==
// @name Gerrit Rerun Hooks Comment Button
// @namespace http://www.ovirt.org/gmscripts
// @description Add a button that will add a comment with rerun-hooks message
// @grant none
// @include https://gerrit.ovirt.org/#/c/*
// @version 0.1
// @run-at document-idle
// ==/UserScript==
var BTN_TEXT="Rerun Hooks";
var BTN_ID="rerunHooks";
var MESSAGE={message: "Rerun-Hooks: all"};
window.setInterval(function () {
if (!document.getElementById(BTN_ID)) {
var btn = document.createElement("button");
btn.id = BTN_ID;
var project = 'ovirt-engine';
var branch = 'master';
var changeId = 'I92a7df2771bba55db485fc0c265dcb367c092102';
btn.onclick = function (self) {
Gerrit.post(
'/changes/' + project + '~' + branch + '~' + changeId + '/revisions/current/review',
MESSAGE,
function (r) {}
);
};
btn.appendChild(document.createTextNode(BTN_TEXT));
document.getElementById("change_actions").appendChild(btn);
}
}, 5000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment