Last active
February 13, 2023 21:08
-
-
Save ricekot/a1331d4fd28bd6709f981b36d91cdb2e to your computer and use it in GitHub Desktop.
A tampermonkey script which adds a review checklist to GitHub PRs.
This file contains hidden or 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
| // ==UserScript== | |
| // @name GitHub Code Review Checklist | |
| // @namespace https://ricekot.com/ | |
| // @version 0.1 | |
| // @description Adds a code review checklist to GitHub PRs. | |
| // @author ricekot | |
| // @match https://github.com/*/*/pull/*/files | |
| // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== | |
| // @grant none | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| let checklist = ` | |
| <div class="diffbar-item dropdown js-review-checklist-container mr-3"> | |
| <details class="details-reset details-overlay js-dropdown-details position-relative" id="review-checklist-modal"> | |
| <summary data-view-component="true" class="js-review-checklist-toggle btn-sm btn"> Review Checklist | |
| <span class="dropdown-caret"></span> | |
| </summary> | |
| <div class="SelectMenu left-0"> | |
| <div class="pull-request-suggested-changes-menu SelectMenu-modal top-0 p-0 mt-sm-2" style="max-width: 300px;" | |
| id="review-checklist"> | |
| <header class="SelectMenu-header p-2"> | |
| <span class="SelectMenu-title">Review Checklist</span> | |
| <button class="SelectMenu-closeButton" type="button" data-toggle-for="review-checklist-modal"> | |
| <svg aria-label="Review Checklist dialog" role="img" height="16" viewBox="0 0 16 16" version="1.1" | |
| width="16" data-view-component="true" class="octicon octicon-x"> | |
| <path fill-rule="evenodd" | |
| d="M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"> | |
| </path> | |
| </svg> | |
| </button> | |
| </header> | |
| <div class="comment-body markdown-body js-preview-body" data-skip-sizing="" style="max-height:50vh;"> | |
| <ul class="contains-task-list"> | |
| <li class="task-list-item"><input type="checkbox" class="task-list-item-checkbox"> Requirement 1</li> | |
| <li class="task-list-item"><input type="checkbox" class="task-list-item-checkbox"> Requirement 2</li> | |
| </ul> | |
| </div> | |
| </details> | |
| </div> | |
| `; | |
| document.querySelector('div.pr-review-tools').insertAdjacentHTML("afterbegin", checklist); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment