summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-01-21 17:42:03 +0100
committerGitHub <noreply@github.com>2024-01-21 17:42:03 +0100
commitc809346b43727efcfe92b4b815a2eef7d2fb675f (patch)
tree5fc546b9dcddc80fbe953a201b1ca5c737cc7f16
parentMerge pull request #1492 from hlohaus/neww (diff)
parentCast pr number (diff)
downloadgpt4free-c809346b43727efcfe92b4b815a2eef7d2fb675f.tar
gpt4free-c809346b43727efcfe92b4b815a2eef7d2fb675f.tar.gz
gpt4free-c809346b43727efcfe92b4b815a2eef7d2fb675f.tar.bz2
gpt4free-c809346b43727efcfe92b4b815a2eef7d2fb675f.tar.lz
gpt4free-c809346b43727efcfe92b4b815a2eef7d2fb675f.tar.xz
gpt4free-c809346b43727efcfe92b4b815a2eef7d2fb675f.tar.zst
gpt4free-c809346b43727efcfe92b4b815a2eef7d2fb675f.zip
-rw-r--r--etc/tool/copilot.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/etc/tool/copilot.py b/etc/tool/copilot.py
index 21f54d6d..5e24e12d 100644
--- a/etc/tool/copilot.py
+++ b/etc/tool/copilot.py
@@ -32,7 +32,9 @@ def get_pr_details(github: Github) -> PullRequest:
"""
'./pr_number'
with open('./pr_number', 'r') as file:
- pr_number = file.read()
+ pr_number = int(file.read())
+ if not pr_number:
+ return
repo = github.get_repo(GITHUB_REPOSITORY)
pull = repo.get_pull(pr_number)
@@ -214,6 +216,9 @@ def main():
try:
github = Github(GITHUB_TOKEN)
pull = get_pr_details(github)
+ if not pull:
+ print(f"No PR number found")
+ exit()
diff = get_diff(pull.diff_url)
except Exception as e:
print(f"Error get details: {e.__class__.__name__}: {e}")