使用当前的pygithub对我有效:
from github import Github
g = Github(GITHUB_TOKEN)
repo_name = 'Org/repo'
repo = g.get_repo(repo_name)
pr = repo.get_pull(PR_NUMBER)
pr.create_issue_comment('test')
gh = ... # Connection
repo = gh.repository(user, repo_name)
pr = repo.create_pull(description, base, from_branch, detailed)
issue = repo.issue(pr.number)
issue.create_comment(comment)
您也可以使用其他方法通过PR号获取问题。
不确定是否有比这更直接的方法。
issue = repo.get_issue(pr.number)
。 - Donn Lee