diff options
| author | Lee James <[email protected]> | 2025-08-06 09:06:37 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-06 13:06:37 +0000 |
| commit | b38f377c9a2672e88dd15119b38d908c0f00b54a (patch) | |
| tree | f8cd37038f592ab31f501c9f85df7fc659ae4f64 /packages/cli/src/ui/commands/setupGithubCommand.ts | |
| parent | aab850668c99e1c39a55036069d9f4b06ca458f4 (diff) | |
feat: Enable /setup-github to always run, and error appropriately (#5653)
Co-authored-by: Jacob Richman <[email protected]>
Diffstat (limited to 'packages/cli/src/ui/commands/setupGithubCommand.ts')
| -rw-r--r-- | packages/cli/src/ui/commands/setupGithubCommand.ts | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/packages/cli/src/ui/commands/setupGithubCommand.ts b/packages/cli/src/ui/commands/setupGithubCommand.ts index 445c0e76..047e11eb 100644 --- a/packages/cli/src/ui/commands/setupGithubCommand.ts +++ b/packages/cli/src/ui/commands/setupGithubCommand.ts @@ -19,12 +19,21 @@ export const setupGithubCommand: SlashCommand = { description: 'Set up GitHub Actions', kind: CommandKind.BUILT_IN, action: (): SlashCommandActionReturn => { - const gitRootRepo = execSync('git rev-parse --show-toplevel', { - encoding: 'utf-8', - }).trim(); - if (!isGitHubRepository()) { - throw new Error('Unable to determine the Git root directory.'); + throw new Error( + 'Unable to determine the GitHub repository. /setup-github must be run from a git repository.', + ); + } + + let gitRootRepo: string; + try { + gitRootRepo = execSync('git rev-parse --show-toplevel', { + encoding: 'utf-8', + }).trim(); + } catch { + throw new Error( + 'Unable to determine the GitHub repository. /setup-github must be run from a git repository.', + ); } const version = 'v0'; |
