Created
September 7, 2022 16:04
-
-
Save anton-chernianu/a03110778b3191c6bb54f2d6f1b0f21f to your computer and use it in GitHub Desktop.
GitLab automatic addition of reviewers to MR [JS Snippet]
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
const USER_NAMES = [ | |
'a.chernianu', | |
'a.chernianu', | |
'a.chernianu', | |
] | |
const reviewerBtn=document.querySelector(".js-reviewer-search"),eventInput=new Event("input",{bubbles:!0,cancelable:!0}),enterEvent=new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,keyCode:13}),wait=async a=>new Promise(b=>setTimeout(b,a)),searchUser=async a=>new Promise(async c=>{let b=document.querySelector(".dropdown-menu-reviewer .dropdown-input-field");b.value=a,b.dispatchEvent(eventInput),await wait(1e3);let d=document.querySelectorAll(".dropdown-menu-user-link")[0];d.dispatchEvent(enterEvent),c(!0)});(async()=>{reviewerBtn.click(),await wait(200);for(let a=0;a<USER_NAMES.length;a++)await searchUser(USER_NAMES[a])})() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment