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

2024-06-01 09:04:30 发布

您现在位置:Python中文网/ 问答频道 /正文

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


Tags: pybaselabels属性titlerepositorycreatebody