tidb-incubator / cherry-bot

Apache License 2.0
25 stars 13 forks source link

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

Open seiya-annie opened 3 years ago

seiya-annie commented 3 years ago

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 commented 3 years ago

/label type/feature-requet

ti-srebot commented 3 years ago

These labels are not found type/feature-requet.

seiya-annie commented 3 years ago

/label type/feature-request