本文整理匯總了Golang中k8s/io/contrib/mungegithub/github.MungeObject.SetMilestone方法的典型用法代碼示例。如果您正苦於以下問題:Golang MungeObject.SetMilestone方法的具體用法?Golang MungeObject.SetMilestone怎麽用?Golang MungeObject.SetMilestone使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類k8s/io/contrib/mungegithub/github.MungeObject
的用法示例。
在下文中一共展示了MungeObject.SetMilestone方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Munge
// Munge is the workhorse the will actually make updates to the PR
func (c *CherrypickAutoApprove) Munge(obj *github.MungeObject) {
if !obj.IsPR() {
return
}
if obj.IsForBranch("master") {
return
}
if obj.HasLabel(cpApprovedLabel) && obj.ReleaseMilestone() != "" {
return
}
parents := getCherrypickParentPRs(obj, c.config)
if len(parents) == 0 {
return
}
major := 0
minor := 0
branch := obj.Branch()
if l, err := fmt.Sscanf(branch, "release-%d.%d", &major, &minor); err != nil || l != 2 {
return
}
branchImpliedMilestone := fmt.Sprintf("v%d.%d", major, minor)
milestone := obj.ReleaseMilestone()
if milestone != "" && milestone != branchImpliedMilestone {
glog.Errorf("Found PR %d on branch %q but have milestone %q", *obj.Issue.Number, branch, milestone)
return
}
for _, parent := range parents {
if !parent.HasLabel(cpApprovedLabel) {
return
}
// If the parent was for milestone v1.2 but this PR has
// comments saying it was 'on branch release-1.1' we should
// not auto approve
parentMilestone := parent.ReleaseMilestone()
if parentMilestone != branchImpliedMilestone {
glog.Errorf("%d: parentReleaseMilestone=%q but branch is %q", *obj.Issue.Number, parentMilestone, obj.Branch())
return
}
}
if milestone == "" {
obj.SetMilestone(branchImpliedMilestone)
}
if !obj.HasLabel(cpApprovedLabel) {
obj.AddLabel(cpApprovedLabel)
}
}