Skip to content

Commit 3707a45

Browse files
committed
better error handling for unauthenticated users
1 parent 99e3338 commit 3707a45

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/git_bob/_terminal.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ def command_line_interface():
33
import sys
44
import signal
55

6-
from ._github_utilities import get_most_recent_comment_on_issue
6+
from ._github_utilities import get_most_recent_comment_on_issue, add_comment_to_issue
77
from ._ai_github_utilities import setup_ai_remark, solve_github_issue, review_pull_request, comment_on_issue
88
from ._endpoints import prompt_claude, prompt_chatgpt
99
from github import Github
@@ -50,6 +50,16 @@ def handler(signum, frame):
5050
members = [member.login for member in repo.get_collaborators()]
5151
if user not in members:
5252
print("User does not have access rights.")
53+
member_names = ", ".join(["@" + str(m) for m in members])
54+
add_comment_to_issue(repository, issue, f"""
55+
Hi @{user},
56+
57+
thanks for reaching out! Unfortunately, I'm not allowed to respond to you directly.
58+
I need approval from a repository member: {member_names}
59+
60+
Best,
61+
git-bob
62+
""")
5363
sys.exit(1)
5464

5565
ai_remark = setup_ai_remark()

0 commit comments

Comments
 (0)