summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Cacqueray <tdecacqu@redhat.com>2019-01-26 03:43:19 +0000
committerTristan Cacqueray <tdecacqu@redhat.com>2019-01-26 03:49:36 +0000
commitce94af3b3f4e6ede9faa6551c256d05395c71695 (patch)
tree939d189335b6fbed9daf9c33143f52ea270f7ca9
parent76ac47442f5fa895f533b9d6c3fc39597d1ef700 (diff)
github: do not use protected=0 to get all project's branches
It seems like github.com api now skips protected branch when using the protected=0 branches query parameter. This results in protected branch being skipped when a tenant doesn't set the exclude-unprotected-branches option. This change fixes this issue by setting protected=1 only when we need to exclude_unprotected branches. The protected parameter behavior can be observed with these URLs: https://api.github.com/repos/ansible/zuul-config/branches -> returns all the branches https://api.github.com/repos/ansible/zuul-config/branches?protected=1 -> returns only the protected branch https://api.github.com/repos/ansible/zuul-config/branches?protected=0 -> returns only the unprotected branch Change-Id: I7e749eb723b02ec9a6f4b6193e727c35165a6b76
Notes
Notes (review): Code-Review+2: Monty Taylor <mordred@inaugust.com> Code-Review+2: Paul Belanger <pabelanger@redhat.com> Code-Review+2: Tobias Henkel <tobias.henkel@bmw.de> Workflow+1: Tobias Henkel <tobias.henkel@bmw.de> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Sat, 26 Jan 2019 17:50:35 +0000 Reviewed-on: https://review.openstack.org/633314 Project: openstack-infra/zuul Branch: refs/heads/master
-rw-r--r--zuul/driver/github/githubconnection.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/zuul/driver/github/githubconnection.py b/zuul/driver/github/githubconnection.py
index 0f57261..d8fbb26 100644
--- a/zuul/driver/github/githubconnection.py
+++ b/zuul/driver/github/githubconnection.py
@@ -1018,8 +1018,9 @@ class GithubConnection(BaseConnection):
1018 'branches') 1018 'branches')
1019 1019
1020 headers = {'Accept': 'application/vnd.github.loki-preview+json'} 1020 headers = {'Accept': 'application/vnd.github.loki-preview+json'}
1021 protected = 1 if exclude_unprotected else 0 1021 params = {'per_page': 100}
1022 params = {'per_page': 100, 'protected': protected} 1022 if exclude_unprotected:
1023 params['protected'] = 1
1023 1024
1024 branches = [] 1025 branches = []
1025 while url: 1026 while url: