summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/commands/setupGithubCommand.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/cli/src/ui/commands/setupGithubCommand.ts')
-rw-r--r--packages/cli/src/ui/commands/setupGithubCommand.ts19
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';