Github Pull Request Review: reset viewed files
GitHub Pull Request Review workflow is great.
What I particularly like is the “file viewed” toggle, which mean that I’m not tempted to re-review the whole Pull Request when a single file has changed and I’ve already checked the rest of them.
However there are instances where I want to re-review the PR as a whole instead of just the changes since my last review. For example when there have been a lot of small changes that add up.
I’ve used the following snippet in the “files” Pull Request Review View (/pulls/{id}/files
) to reset the “viewed” files (if they’re all marked as viewed).
Mark all files in a GitHub PR as “not viewed”:
document.querySelectorAll('.js-reviewed-toggle').forEach(c => c.click())
— Hugo (@hugo__df) June 1, 2020
A smarter way to do this is to uncheck all the checked js-reviewed-checkbox
elements on the page:
Unmark all “viewed” files in a GitHub PR:
document.querySelectorAll('.js-reviewed-checkbox[checked]').forEach(c => c.click())
— Hugo (@hugo__df) July 7, 2020
You can add this to your own browser as a bookmarklet
- Right click on this link: GH Review > Mark all unviewed
- Select “Bookmark this link” or equivalent
- Save it as a bookmark
- You can now use the “GH Review > Mark all unviewed” bookmarklet on the GitHub Review page
Photo by Markus Winkler on Unsplash
Interested in Alpine.js?
Power up your debugging with the Alpine.js Devtools Extension for Chrome and Firefox. Trusted by over 15,000 developers (rated 4.5 ⭐️).
orJoin 1000s of developers learning about Enterprise-grade Node.js & JavaScript