(rootDir: string)
| 12 | ]; |
| 13 | |
| 14 | export async function ciSetupCommand(rootDir: string): Promise<void> { |
| 15 | p.intro(pc.bgCyan(pc.black(' bumpy ci setup '))); |
| 16 | |
| 17 | // Detect repo and package manager context |
| 18 | const repo = detectRepo(rootDir); |
| 19 | if (!repo) { |
| 20 | log.error( |
| 21 | 'Could not detect a GitHub repository.\n' + |
| 22 | ' This command currently only supports GitHub-hosted repos.\n' + |
| 23 | ' Make sure you have a GitHub remote (git remote -v).', |
| 24 | ); |
| 25 | process.exit(1); |
| 26 | } |
| 27 | const pm = await detectPackageManager(rootDir); |
| 28 | |
| 29 | p.log.info(`Detected repository: ${pc.cyan(repo)}`); |
| 30 | p.log.info(''); |
| 31 | p.log.info( |
| 32 | 'To trigger CI checks on the version PR, bumpy needs a token\n' + |
| 33 | "that bypasses GitHub's default anti-recursion guard.\n" + |
| 34 | 'You can use a fine-grained PAT or a GitHub App installation token.', |
| 35 | ); |
| 36 | |
| 37 | const method = unwrap( |
| 38 | await p.select({ |
| 39 | message: 'How would you like to authenticate?', |
| 40 | options: [ |
| 41 | { |
| 42 | label: 'Fine-grained Personal Access Token (PAT)', |
| 43 | value: 'pat' as const, |
| 44 | hint: 'recommended — quick and simple', |
| 45 | }, |
| 46 | { |
| 47 | label: 'GitHub App installation token', |
| 48 | value: 'app' as const, |
| 49 | hint: 'advanced — not tied to a personal account', |
| 50 | }, |
| 51 | ], |
| 52 | }), |
| 53 | ); |
| 54 | |
| 55 | if (method === 'pat') { |
| 56 | await setupPat(rootDir, repo, pm); |
| 57 | } else { |
| 58 | await setupApp(rootDir, repo, pm); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | // ---- PAT flow ---- |
| 63 |
no test coverage detected
searching dependent graphs…