如何使用github3.py为新的拉取请求添加标签



我看到github3.py在Repository.create_pull((上仍然没有Repository.create_issue((中的属性标签。但在ShortPullRequest上创建了属性标签。所以我尝试了:

created_pr = repo.create_pull(
title=pr.title,
body=pr.body,
head=pr.head,
base=pr.base,
)
if pr.labels:
created_pr.labels = pr.labels
created_pr.update()

问题是,在我查看GitHub后,PR是在没有标签的情况下创建的。使用这个组件有什么解决方案吗?

注意:我不能使用pygithub,因为他们使用LGPL许可证,我想制作MIT许可证代码。

实际上,这样做的方法是:

if pr.labels:
issue = created_pr.issue()
issue.add_labels(*pr.labels)

感谢Github上的@sigmavirus24。

最新更新