Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion potential_closeable_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# dependencies = [
# "ghapi",
# "rich",
# "stamina",
# ]
# ///

Expand All @@ -18,7 +19,9 @@
import json
import os
from typing import Any, TypeAlias
from urllib.error import HTTPError

import stamina
from fastcore.net import HTTP404NotFoundError
from fastcore.xtras import obj2dict
from ghapi.all import GhApi, paged # pip install ghapi
Expand Down Expand Up @@ -68,7 +71,9 @@ def check_issue(api: GhApi, issue: Issue) -> list[Issue]:
word = next(word for word in pr_line.split() if word.startswith("gh-"))
pr_number = int(word.split("-")[1])
try:
pr = api.pulls.get(pr_number)
for attempt in stamina.retry_context(on=HTTPError):
with attempt:
pr = api.pulls.get(pr_number)
except HTTP404NotFoundError as e:
print(f"[yellow]PR {pr_number} not found: {e}[/yellow]")
continue
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ pytest
pytest-cov
requests
rich
stamina
termcolor