Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
seiya-annie opened this issue Nov 17, 2020 · 3 comments
Labels
type/feature-request As a user, I want to request a New Feature on the product

Comments

@seiya-annie
Copy link
Contributor

seiya-annie commented Nov 17, 2020

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
Copy link
Contributor Author

/label type/feature-requet

@ti-srebot
Copy link
Collaborator

These labels are not found type/feature-requet.

@seiya-annie
Copy link
Contributor Author

/label type/feature-request

@ti-srebot ti-srebot added the type/feature-request As a user, I want to request a New Feature on the product label Nov 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature-request As a user, I want to request a New Feature on the product
Projects
None yet
Development

No branches or pull requests

2 participants