问题
I am using github3 python API and I have this piece of code:
# Create new PR or get existing one
prs = [pr for pr in repo.iter_pulls(state="open", base="master",
head="rev_testrev2")]
if len(prs) > 0:
pr = prs[0]
else:
pr = repo.create_pull("My pull request", "master", "rev_testrev2",
"This is a test pull request")
comments = [c for c in pr.iter_comments()]
print str(comments)
In the PR, in github web page, I have several comments in the "conversation" tab and just 1 in "Files Changed" tab.
The code above only prints the comments made in the "Files Changed" tab, which are associated with a file changed on a commit.
How do I list or create a PR comment created in the "Conversation" tab?
回答1:
You can't list all of the comments on a Pull Request at once if I remember correctly. That said, you can get review comments with iter_comments
as you're already doing.
It's important to keep in mind that as far as GitHub is concerned, pull requests are just issues with a little extra on top. So to get the comments in the conversation tab, you need to use iter_issue_comments.
print(list(pr.iter_issue_comments()))
来源:https://stackoverflow.com/questions/31325449/why-arent-conversation-comments-in-a-pull-request-being-returned-from-pullreque