Back
GitHub Pull Request - Mark All Files As Viewed with JS
Mark ALL files as Viewed in a GitHub Pull Request with this JavaScript and your browsers DevTools.
Reviewing a Pull Request on GitHub Can be Tedious
If you've ever pushed a large pull request to GitHub, you know how much time it can take to mark each file as verified. There are times this is necessary, but sometimes it's redundant. For the times it is, I created a JavaScript function to automate the process.
Execute this JavaScript in DevTools to Mark All Files as Viewed
Instead of manually checking every single file that's already been reviewed, navigate to the Pull Request Code Review tab and copy/paste the JS below into your browser's DevTools.
Copy
1function markAllFilesAsViewed() {
2 let filesChecked = Number();
3 let filesAlreadyChecked = Number();
4 let allCheckBoxes = document.getElementsByClassName("js-reviewed-checkbox");
5
6 for (let i = 0; i < allCheckBoxes.length; i++) {
7 const checkBox = allCheckBoxes[i];
8 if (!checkBox.checked) {
9 checkBox.click();
10 filesChecked++;
11 }
12 else {
13 filesAlreadyChecked++;
14 }
15 }
16
17 if (filesChecked > 0) {
18 console.group("GitHub - Mark All Files As Viewed");
19 console.log("Marked " + filesChecked + " files as viewed.");
20 console.log("There were " + filesAlreadyChecked + " files already marked as viewed.")
21 console.groupEnd();
22 }
23 else {
24 console.group("GitHub - Mark All Files As Viewed");
25 console.log(filesAlreadyChecked + " files already marked as viewed.");
26 console.groupEnd();
27 }
28
29};
30markAllFilesAsViewed()js