( path: string, expectedRepo: string, )
| 103 | * @returns true if the path contains the expected repo, false otherwise |
| 104 | */ |
| 105 | export async function validateRepoAtPath( |
| 106 | path: string, |
| 107 | expectedRepo: string, |
| 108 | ): Promise<boolean> { |
| 109 | try { |
| 110 | const remoteUrl = await getRemoteUrlForDir(path) |
| 111 | if (!remoteUrl) { |
| 112 | return false |
| 113 | } |
| 114 | |
| 115 | const actualRepo = parseGitHubRepository(remoteUrl) |
| 116 | if (!actualRepo) { |
| 117 | return false |
| 118 | } |
| 119 | |
| 120 | // Case-insensitive comparison |
| 121 | return actualRepo.toLowerCase() === expectedRepo.toLowerCase() |
| 122 | } catch { |
| 123 | return false |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * Removes a path from the tracked paths for a given repository. |
no test coverage detected