Skip to content

Commit f62ccb1

Browse files
committed
don't corrupt the state if homu doesn't have access to the repo
1 parent 9247593 commit f62ccb1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

homu/server.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -793,8 +793,13 @@ def buildbot():
793793

794794

795795
def synch(user_gh, state, repo_label, repo_cfg, repo):
796-
if not repo.is_collaborator(user_gh.user().login):
797-
abort(400, 'You are not a collaborator')
796+
try:
797+
if not repo.is_collaborator(user_gh.user().login):
798+
abort(400, 'You are not a collaborator')
799+
except github3.GitHubError as e:
800+
if e.code == 403:
801+
abort(400, 'Homu does not have write access on the repository')
802+
raise e
798803

799804
Thread(target=synchronize, args=[repo_label, repo_cfg, g.logger,
800805
g.gh, g.states, g.repos, g.db,

0 commit comments

Comments
 (0)