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

add new hook to add new template in comment #50

Merged
merged 8 commits into from
Sep 8, 2020

Conversation

seiya-annie
Copy link
Contributor

What problem does this PR solve?

Problem Summary:

What is changed and how it works?

What's Changed: add a new hook to give template in the comment when user input /info

How it Works: in the comment input box, input '/info'

Release note

No release note

@seiya-annie seiya-annie marked this pull request as draft September 1, 2020 08:33
@seiya-annie seiya-annie marked this pull request as ready for review September 1, 2020 08:35
"github.com/pkg/errors"
"io/ioutil"
"regexp"
"strings"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

group this import?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed it

issueID := event.GetIssue().GetNumber()
temMatches := templatePattern.FindStringSubmatch(comment)
if strings.TrimSpace(temMatches[0]) == "/info" {
return errors.Wrap(c.addTemplate(issueID), "label issue")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here will always return error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, my mistake, will fix it

templatePattern = regexp.MustCompile(`\/info`)
)

func (c *Comment) ProcessIssueCommentEvent(event *github.IssueCommentEvent) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When this function will be called

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bot/webhook.go may need to be updated.

Copy link
Contributor Author

@seiya-annie seiya-annie Sep 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, I will add this process in bot entrance function

@you06
Copy link
Contributor

you06 commented Sep 1, 2020

IMO the template.txt may be specified from config file and not in code repo.

@seiya-annie
Copy link
Contributor Author

IMO the template.txt may be specified from config file and not in code repo.

OK, I will try to fix this

Copy link
Contributor

@zhouqiang-cl zhouqiang-cl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
@you06 @AndreMouche PTAL

@seiya-annie
Copy link
Contributor Author

IMO the template.txt may be specified from config file and not in code repo.

我看了一下,我直接把这个文件从repo里删除,然后放到和生成的 bot 文件同一个目录就行吧。我直接删除吧。

@you06
Copy link
Contributor

you06 commented Sep 8, 2020

Mostly LGTM, can you remove some unnecessary comments from code?

@you06 you06 merged commit 57297ef into tidb-incubator:master Sep 8, 2020
@you06
Copy link
Contributor

you06 commented Sep 8, 2020

Thanks for this PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants