Skip to content

Commit f5ee1ba

Browse files
committed
fixes #197
1 parent 015bace commit f5ee1ba

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

dialoghelper/core.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1091,13 +1091,15 @@ def _fmt_replies(api, owner, repo, num):
10911091
# %% ../nbs/00_core.ipynb #6d26d0ed
10921092
@llmtool
10931093
def read_pr(
1094-
pr_number:int, # Issue or PR number
1094+
pr_number:int|str, # Issue/PR number, or GitHub issue/PR URL
10951095
owner:str='answerdotai', # Owner
10961096
repo:str=None, # Repo
10971097
folder:str='', # For diffs, limit to only to files in `folder`
10981098
replies:bool=False # Include replies
10991099
):
11001100
"Fetch a GitHub PR or issue's title, body, optionally replies, and diff (if PR)"
1101+
if '/' in str(pr_number): *_,owner,repo,typ,pr_number = str(pr_number).rstrip('/').split('/')
1102+
pr_number = int(pr_number)
11011103
if folder: folder = f"{folder}/"
11021104
api = GhApi()
11031105
res = None

nbs/00_core.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4067,13 +4067,15 @@
40674067
"#| export\n",
40684068
"@llmtool\n",
40694069
"def read_pr(\n",
4070-
" pr_number:int, # Issue or PR number\n",
4070+
" pr_number:int|str, # Issue/PR number, or GitHub issue/PR URL\n",
40714071
" owner:str='answerdotai', # Owner\n",
40724072
" repo:str=None, # Repo\n",
40734073
" folder:str='', # For diffs, limit to only to files in `folder`\n",
40744074
" replies:bool=False # Include replies\n",
40754075
"):\n",
40764076
" \"Fetch a GitHub PR or issue's title, body, optionally replies, and diff (if PR)\"\n",
4077+
" if '/' in str(pr_number): *_,owner,repo,typ,pr_number = str(pr_number).rstrip('/').split('/')\n",
4078+
" pr_number = int(pr_number)\n",
40774079
" if folder: folder = f\"{folder}/\"\n",
40784080
" api = GhApi()\n",
40794081
" res = None\n",

0 commit comments

Comments
 (0)