本文整理汇总了Python中github.GitHub.addlabel方法的典型用法代码示例。如果您正苦于以下问题:Python GitHub.addlabel方法的具体用法?Python GitHub.addlabel怎么用?Python GitHub.addlabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.GitHub
的用法示例。
在下文中一共展示了GitHub.addlabel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: from github import GitHub [as 别名]
# 或者: from github.GitHub import addlabel [as 别名]
tickets = trac.sql('SELECT id, summary, description , owner, milestone, component, status, type, priority FROM ticket ORDER BY id') # LIMIT 5
for tid, summary, description, owner, milestone, component, status, type, priority in tickets:
logging.info("Ticket %d: %s" % (tid, summary))
if description:
description = description.strip()
if milestone:
milestone = milestone.strip()
issue = {'title': summary}
if description:
issue['body'] = description
if milestone:
m = milestone_id.get(milestone)
if m:
issue['milestone'] = m
if component:
github.addlabel(component, labels, issue, logging)
if type:
# Map 'defect' to 'bug'
if type == 'defect':
type = 'bug'
github.addlabel(type, labels, issue, logging)
if priority:
github.addlabel(priority, labels, issue, logging)
# We have to create/map Trac users to GitHub usernames before we can assign
# them to tickets; don't see how to do that conveniently now.
# if owner.strip():
# ticket['assignee'] = owner.strip()
gh_issue = github.issues(data=issue)
# Add comments
comments = trac.sql('SELECT author, newvalue AS body FROM ticket_change WHERE field="comment" AND ticket=%s' % tid)