cherry-bot icon indicating copy to clipboard operation
cherry-bot copied to clipboard

bug template should not commit when partial match '/info' substring in comment

Open seiya-annie opened this issue 5 years ago • 3 comments

Bug Report

/info command should use full match, not partial match. eg: when has '/information' in comment, should not trigger add template function root cause: in the page, https://github.com/pingcap-incubator/cherry-bot/blob/master/pkg/providers/add-template/event.go should not use if len(temMatches) > 0 && strings.TrimSpace(temMatches[0]) == "/info" { should use if comment == '/info'

	issueID := event.GetIssue().GetNumber()
	fmt.Println(issueID)
	//fmt.Println(comment)
	temMatches := templatePattern.FindStringSubmatch(comment)
	fmt.Println("temMatches:", temMatches)
	if len(temMatches) > 0 && strings.TrimSpace(temMatches[0]) == "/info" {
		e := c.addTemplate(issueID)
		if e != nil {
			err := errors.Wrap(e, "add template to comment fail")
			return err
		}
	}

	return nil
}



seiya-annie avatar Nov 17 '20 08:11 seiya-annie

/label type/feature-requet

seiya-annie avatar Nov 17 '20 08:11 seiya-annie

These labels are not found type/feature-requet.

ti-srebot avatar Nov 17 '20 08:11 ti-srebot

/label type/feature-request

seiya-annie avatar Nov 17 '20 08:11 seiya-annie