當前位置: 首頁>>代碼示例>>Golang>>正文


Golang MungeObject.GetEvents方法代碼示例

本文整理匯總了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)
}
開發者ID:spxtr,項目名稱:contrib,代碼行數:29,代碼來源:lgtm_handler.go

示例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
}
開發者ID:spxtr,項目名稱:contrib,代碼行數:34,代碼來源:issue-categorizer.go

示例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
}
開發者ID:spxtr,項目名稱:contrib,代碼行數:21,代碼來源:close-stale-pr.go


注:本文中的k8s/io/contrib/mungegithub/github.MungeObject.GetEvents方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。