0

我看到 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 许可证代码。

4

1 回答 1

0

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

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

感谢 Github 上的 @sigmavirus24。

于 2020-10-06T14:42:48.627 回答