From e65913f6d271ac658b7b9eb2e42d7acbd26b933b Mon Sep 17 00:00:00 2001 From: Brian Carey Date: Mon, 22 Jan 2024 08:43:51 +0000 Subject: [PATCH] Skip phase plugin comments when counting the number of retests required The phase plugin adds a comment[1] to PRs that are lgtm + approve - this comment triggers the jobs that are required before merge but not run against every change (phase 2). Currently this is counted as a retest which is not valid- and it should be skipped. [1] https://github.com/kubevirt/project-infra/blob/d4470b4eda1df31056239b21a466faf49f3f8852/external-plugins/phased/plugin/handler/handler.go#L21 Signed-off-by: Brian Carey --- pkg/chatops/main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/chatops/main.go b/pkg/chatops/main.go index ae6386afa8..41bb6b7c0e 100644 --- a/pkg/chatops/main.go +++ b/pkg/chatops/main.go @@ -53,9 +53,14 @@ func (co *Handler) RetestsToMerge(startDate, endDate time.Time) (map[types.PR]in // after the last commit or force push. func RetestComments(pr *types.ChatopsPullRequestFragment) int { var total int + const phase2Intro = "Required labels detected, running phase 2 presubmits:" + lastPush := determineLastPush(pr) for _, timelineItem := range pr.TimelineItems.Nodes { + if strings.Contains(timelineItem.BodyText, phase2Intro) { + continue + } if isRetestCommentAfterLastPush(timelineItem, lastPush) { total += 1 }