Created
October 13, 2023 00:15
-
-
Save dound/593e4a9aef6ddf9021dc065e5f4b6b04 to your computer and use it in GitHub Desktop.
Hide certain file paths in a GitHub PR
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
function markMatchingFilesAsViewed() { | |
// hide files with GeneratedCode in their path, or ending with .meta or .asset | |
const regex = /(GeneratedCode)|(.meta$)|(.asset$)/ | |
const fileDivs = document.getElementsByClassName('file-header'); | |
let numMatches = 0; | |
let numClicks = 0; | |
for (const fileDiv of fileDivs) { | |
const filePath = fileDiv.getElementsByClassName('Truncate')[0]?.children[0]?.getAttribute('title') ?? '' | |
if (filePath.match(regex)) { | |
console.log(filePath); | |
numMatches += 1; | |
const checkbox = fileDiv.getElementsByClassName('js-reviewed-checkbox')[0]; | |
if (!checkbox.checked) { | |
checkbox.click(); | |
numClicks += 1; | |
} | |
} | |
} | |
console.log(`${numMatches} of ${files.length} files matched; toggled ${numClicks} from unviewed to viewed`); | |
} | |
markMatchingFilesAsViewed() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment