Skip to content

Commit a02c341

Browse files
committed
Tweaks
1 parent 9027f69 commit a02c341

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/github.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def make_headers(self) -> dict:
1616
'content-type': 'application/vnd.github.v3+json',
1717
}
1818

19-
def get_paginated_branches_url(self, page: int = 0):
19+
def get_paginated_branches_url(self, page: int = 0) -> str:
2020
return f'{GH_BASE_URL}/repos/{self.github_repo}/branches?protected=false&per_page=30&page={page}'
2121

2222
def get_deletable_branches(self, last_commit_age_days: int, ignore_branches: list) -> list:
@@ -79,7 +79,11 @@ def get_deletable_branches(self, last_commit_age_days: int, ignore_branches: lis
7979

8080
# Re-request next page
8181
current_page += 1
82+
8283
response = requests.get(url=self.get_paginated_branches_url(page=current_page), headers=headers)
84+
if response.status_code != 200:
85+
raise RuntimeError(f'Failed to make request to {url}. {response} {response.json()}')
86+
8387
branches: list = response.json()
8488

8589
return deletable_branches

0 commit comments

Comments
 (0)