本文整理匯總了Golang中k8s/io/contrib/mungegithub/github.MungeObject.OpenPR方法的典型用法代碼示例。如果您正苦於以下問題:Golang MungeObject.OpenPR方法的具體用法?Golang MungeObject.OpenPR怎麽用?Golang MungeObject.OpenPR使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類k8s/io/contrib/mungegithub/github.MungeObject
的用法示例。
在下文中一共展示了MungeObject.OpenPR方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Munge
// Munge is the workhorse the will actually make updates to the PR
func (PingCIMunger) Munge(obj *github.MungeObject) {
if !obj.IsPR() {
return
}
if !obj.HasLabel("lgtm") {
return
}
mergeable, err := obj.IsMergeable()
if err != nil {
glog.V(2).Infof("Skipping %d - problem determining mergeability", *obj.Issue.Number)
return
}
if !mergeable {
glog.V(2).Infof("Skipping %d - not mergeable", *obj.Issue.Number)
return
}
if state := obj.GetStatusState([]string{jenkinsCIContext, travisContext}); state != "incomplete" {
glog.V(2).Info("Have %s status - skipping ping CI", jenkinsCIContext)
return
}
state := obj.GetStatusState([]string{shippableContext, travisContext})
if state == "incomplete" {
msg := "Continuous integration appears to have missed, closing and re-opening to trigger it"
obj.WriteComment(msg)
obj.ClosePR()
time.Sleep(5 * time.Second)
obj.OpenPR(10)
}
}
示例2: Munge
// Munge is the workhorse the will actually make updates to the PR
func (PingCIMunger) Munge(obj *github.MungeObject) {
if !obj.IsPR() {
return
}
// This munger only runs on certain branches, since travis/CI only listens
// on certain branches
validBranch := false
for _, b := range validBranches {
if obj.IsForBranch(b) {
validBranch = true
break
}
}
if !validBranch {
return
}
if !obj.HasLabel(lgtmLabel) {
return
}
mergeable, err := obj.IsMergeable()
if err != nil {
glog.V(2).Infof("ping CI skipping %d - problem determining mergeability", *obj.Issue.Number)
return
}
if !mergeable {
glog.V(2).Infof("ping CI skipping %d - not mergeable", *obj.Issue.Number)
return
}
if state := obj.GetStatusState([]string{travisContext}); state == "incomplete" {
msg := "Travis continuous integration appears to have missed, closing and re-opening to trigger it"
obj.WriteComment(msg)
obj.ClosePR()
time.Sleep(5 * time.Second)
obj.OpenPR(10)
}
}