(path: string)
| 109 | } |
| 110 | |
| 111 | export function isReviewableCommitPath(path: string): boolean { |
| 112 | const normalized = path.replaceAll("\\", "/"); |
| 113 | const name = normalized.split("/").pop() ?? normalized; |
| 114 | const lowerName = name.toLowerCase(); |
| 115 | const lowerPath = normalized.toLowerCase(); |
| 116 | if (REVIEWABLE_BASENAMES.has(name) || REVIEWABLE_BASENAMES.has(lowerName)) return true; |
| 117 | if (lowerPath.startsWith(".github/workflows/")) return true; |
| 118 | if (lowerPath.startsWith("scripts/") || lowerPath.startsWith("bin/")) return true; |
| 119 | if (/^changelog(?:\.[^.]+)?$/i.test(name)) return false; |
| 120 | if (/^(readme|license|notice|authors|contributors)(?:\.[^.]+)?$/i.test(name)) return false; |
| 121 | if (/(^|\/)(docs?|documentation|changesets?|\.changeset)\//i.test(normalized)) return false; |
| 122 | const extensionMatch = lowerName.match(/(\.[a-z0-9]+)$/); |
| 123 | if (!extensionMatch) return false; |
| 124 | const extension = extensionMatch[1] ?? ""; |
| 125 | if ( |
| 126 | [ |
| 127 | ".adoc", |
| 128 | ".gif", |
| 129 | ".ico", |
| 130 | ".jpeg", |
| 131 | ".jpg", |
| 132 | ".md", |
| 133 | ".mdx", |
| 134 | ".mov", |
| 135 | ".mp4", |
| 136 | ".pdf", |
| 137 | ".png", |
| 138 | ".rst", |
| 139 | ".svg", |
| 140 | ".txt", |
| 141 | ".webp", |
| 142 | ].includes(extension) |
| 143 | ) { |
| 144 | return false; |
| 145 | } |
| 146 | return REVIEWABLE_EXTENSIONS.has(extension); |
| 147 | } |
| 148 | |
| 149 | export function changedFilesForCommit(targetDir: string, sha: string, parents: string[]): string[] { |
| 150 | const args = parents[0] |
no test coverage detected