Merge "Annotate getBranch with event id"

This commit is contained in:
Zuul 2020-09-16 21:56:20 +00:00 committed by Gerrit Code Review
commit e8cbc287eb
1 changed files with 5 additions and 3 deletions

View File

@ -429,7 +429,8 @@ class GithubEventProcessor(object):
# unprotected branches, we might need to check whether the
# branch is now protected.
if hasattr(event, "branch") and event.branch:
b = self.connection.getBranch(project.name, event.branch)
b = self.connection.getBranch(
project.name, event.branch, zuul_event_id=event)
if b is not None:
branch_protected = b.get('protected')
self.connection.checkBranchCache(
@ -1561,8 +1562,9 @@ class GithubConnection(BaseConnection):
cache[project.name] = branches
return branches
def getBranch(self, project_name, branch):
github = self.getGithubClient(project_name)
def getBranch(self, project_name, branch, zuul_event_id=None):
github = self.getGithubClient(
project_name, zuul_event_id=zuul_event_id)
# Note that we directly use a web request here because if we use the
# github3.py api directly we need a repository object which needs