Skip to content

Instantly share code, notes, and snippets.

@tiegz
Created April 8, 2024 19:47
Show Gist options
  • Save tiegz/529205b20729c48940414760901831f9 to your computer and use it in GitHub Desktop.
Save tiegz/529205b20729c48940414760901831f9 to your computer and use it in GitHub Desktop.
Assign a group of people to review a PR
// Add GH usernames to this list to assign them as reviewers
var team = [];
var menu = document.getElementById('reviewers-select-menu')
var summary = menu.getElementsByTagName('summary')[0]
// Open assignee modal
summary.click();
// Close assignee modal
summary.click();
var wait_attempts = 5;
var poll_and_select = () => {
var usernames = menu.getElementsByClassName('js-username');
if (usernames.length > 0) {
for (var i in usernames) {
if (team.includes(usernames[i].innerText)) {
console.log("Adding reviewer ", usernames[i].innerText)
usernames[i].click();
}
}
summary.click();
} else if (wait_attempts > 0) {
wait_attempts -= 1;
setTimeout(poll_and_select, 500);
}
};
poll_and_select();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment