Created
December 18, 2023 20:19
-
-
Save kyletolle/52c78647a2a8b34a740e398620545f6d to your computer and use it in GitHub Desktop.
Github PR review: Snippet to check viewed on files renamed without changes or deleted
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
// In a GitHub PR, you can run this script in a console to help automatically click the Viewed checkbox | |
// Worked as of 2023.12.18 | |
// JS snippet to click 'Viewed' on files that were deleted entirely, not changed or renamed | |
Array.from(document.querySelectorAll('.js-diff-load')).forEach(fileInfo => { | |
const text = fileInfo.nextElementSibling.textContent.trim(); | |
if(text.includes('This file was deleted.')) { | |
const viewedCheckbox = fileInfo.closest('.js-file.js-details-container').querySelector('.js-reviewed-checkbox'); | |
if(viewedCheckbox && !viewedCheckbox.checked) { | |
viewedCheckbox.click(); | |
} | |
} | |
}); |
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
// In a GitHub PR, you can run this script in a console to help automatically click the Viewed checkbox. | |
// Worked as of 2023.12.18 | |
// JavaScript snippet to click 'Viewed' on files renamed without changes | |
Array.from(document.querySelectorAll('.data.highlight.empty')).forEach(fileInfo => { | |
const text = fileInfo.textContent.trim(); | |
if(text.includes('File renamed without changes')) { | |
const viewedCheckbox = fileInfo.closest('.js-file.js-details-container').querySelector('.js-reviewed-checkbox'); | |
if(viewedCheckbox && !viewedCheckbox.checked) { | |
viewedCheckbox.click(); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment