本文整理匯總了Golang中k8s/io/contrib/mungegithub/github.MungeObject.GetEvents方法的典型用法代碼示例。如果您正苦於以下問題:Golang MungeObject.GetEvents方法的具體用法?Golang MungeObject.GetEvents怎麽用?Golang MungeObject.GetEvents使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類k8s/io/contrib/mungegithub/github.MungeObject
的用法示例。
在下文中一共展示了MungeObject.GetEvents方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Munge
// Munge is the workhorse the will actually make updates to the PR
func (h LGTMHandler) Munge(obj *github.MungeObject) {
if !obj.IsPR() {
return
}
reviewers := getReviewers(obj)
if len(reviewers) == 0 {
return
}
comments, err := getCommentsAfterLastModified(obj)
if err != nil {
glog.Errorf("unexpected error getting comments: %v", err)
return
}
events, err := obj.GetEvents()
if err != nil {
glog.Errorf("unexpected error getting events: %v", err)
return
}
if !obj.HasLabel(lgtmLabel) {
h.addLGTMIfCommented(obj, comments, events, reviewers)
return
}
h.removeLGTMIfCancelled(obj, comments, events, reviewers)
}
示例2: getHumanCorrectedLabel
func getHumanCorrectedLabel(obj *github.MungeObject, s string) *string {
myEvents, err := obj.GetEvents()
if err != nil {
glog.Errorf("Could not get the events associated with Issue %d", obj.Issue.Number)
return nil
}
botEvents := event.FilterEvents(myEvents, event.And([]event.Matcher{event.BotActor(), event.AddLabel{}, event.LabelPrefix(s)}))
if botEvents.Empty() {
return nil
}
humanEventsAfter := event.FilterEvents(
myEvents,
event.And([]event.Matcher{
event.HumanActor(),
event.AddLabel{},
event.LabelPrefix(s),
event.CreatedAfter(*botEvents.GetLast().CreatedAt),
}),
)
if humanEventsAfter.Empty() {
return nil
}
lastHumanLabel := humanEventsAfter.GetLast()
glog.Infof("Recopying human-added label: %s for PR %d", *lastHumanLabel.Label.Name, *obj.Issue.Number)
obj.RemoveLabel(*lastHumanLabel.Label.Name)
obj.AddLabel(*lastHumanLabel.Label.Name)
return lastHumanLabel.Label.Name
}
示例3: findLastInterestingEventUpdate
func findLastInterestingEventUpdate(obj *github.MungeObject) (*time.Time, error) {
lastInteresting := obj.Issue.CreatedAt
events, err := obj.GetEvents()
if err != nil {
return nil, err
}
for i := range events {
event := events[i]
if event.Event == nil || *event.Event != "reopened" {
continue
}
if lastInteresting.Before(*event.CreatedAt) {
lastInteresting = event.CreatedAt
}
}
return lastInteresting, nil
}