()
| 6 | import * as prettier from "prettier"; |
| 7 | |
| 8 | export function getRepoRoot(): string { |
| 9 | const __filename = fileURLToPath(import.meta.url); |
| 10 | const __dirname = path.dirname(__filename); |
| 11 | let currentDir = __dirname; |
| 12 | |
| 13 | while (currentDir !== path.parse(currentDir).root) { |
| 14 | if (existsSync(path.join(currentDir, ".git"))) { |
| 15 | return currentDir; |
| 16 | } |
| 17 | currentDir = path.dirname(currentDir); |
| 18 | } |
| 19 | |
| 20 | throw new Error("Could not find project root"); |
| 21 | } |
| 22 | |
| 23 | export function getGitHubToken() { |
| 24 | const token = process.env.GITHUB_TOKEN; |
no test coverage detected