Skip to content

Commit 4dcefd7

Browse files
committed
User the applicant's username when commenting on their application
1 parent 5cb74ba commit 4dcefd7

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

script/reviewer.go

+8-7
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ func (r *Reviewer) Review() {
3131

3232
status := r.getStatus()
3333
isClosed := *r.gitHub.Issue.State == "closed"
34+
issueAuthor := *r.gitHub.Issue.User.Login
3435

3536
r.updateLabels(status, isClosed)
36-
r.createComment(status, isClosed)
37+
r.createComment(status, isClosed, issueAuthor)
3738
}
3839

3940
func (r *Reviewer) getStatus() Status {
@@ -48,14 +49,14 @@ func (r *Reviewer) getStatus() Status {
4849
}
4950
}
5051

51-
func (r *Reviewer) createComment(status Status, isClosed bool) {
52+
func (r *Reviewer) createComment(status Status, isClosed bool, issueAuthor string) {
5253
title := ""
5354
body := ""
5455

5556
applicationData := fmt.Sprintf("<details>\n<summary>Application data...</summary>\n\n```json\n%s\n```\n</details>", r.application.GetData())
5657
applicationFilePath := fmt.Sprintf("https://github.com/1Password/1password-teams-open-source/blob/main/data/%s", r.application.FileName())
57-
approvedBody := fmt.Sprintf("This application has already been approved and changes will not be reviewed. If you would like to modify the details of your application, submit a pull request against the stored [application data](%s). If you have any questions, contact us at [[email protected]](mailto:[email protected]).", applicationFilePath)
58-
closedBody := "This application is closed and changes will not be reviewed. If you have any questions, contact us at [[email protected]](mailto:[email protected])."
58+
approvedBody := fmt.Sprintf("@%s this application has already been approved and changes will not be reviewed. If you would like to modify the details of your application, submit a pull request against the stored [application data](%s). If you have any questions, contact us at [[email protected]](mailto:[email protected]).", issueAuthor, applicationFilePath)
59+
closedBody := fmt.Sprintf("@%s this application is closed and changes will not be reviewed. If you have any questions, contact us at [[email protected]](mailto:[email protected]).", issueAuthor)
5960

6061
// If the issue is closed, let the user know that they can't make changes.
6162
// If the issue was closed because it got approved, let them know how they can
@@ -73,14 +74,14 @@ func (r *Reviewer) createComment(status Status, isClosed bool) {
7374
} else if r.application.IsValid() {
7475
if status == Reviewing {
7576
title = "### 👍 Application still valid"
76-
body = fmt.Sprintf("\n\n%s\n\nWe’ve run our automated pre-checks and your updated application is still valid.", applicationData)
77+
body = fmt.Sprintf("\n\n%s\n\n@%s we’ve run our automated pre-checks and your updated application is still valid.", applicationData, issueAuthor)
7778
} else {
7879
title = "### ✅ Your application is valid"
79-
body = fmt.Sprintf("\n\n%s\n\nThanks for applying! Our automated pre-checks have determined your application is valid. Next step: our team will review your application and may have follow-up questions. You can still make changes to your application and it’ll be re-evaluated.", applicationData)
80+
body = fmt.Sprintf("\n\n%s\n\n@%s thanks for applying! Our automated pre-checks have determined your application is valid. Next step: our team will review your application and may have follow-up questions. You can still make changes to your application and it’ll be re-evaluated.", applicationData, issueAuthor)
8081
}
8182
} else {
8283
title = "### ❌ Your application is invalid"
83-
body = fmt.Sprintf("\n\n%s\n\nOur automated pre-checks have detected the following problems:\n\n%s\n\nUpdate this issue to correct these problems and we’ll automatically re-evaluate your application.", applicationData, r.application.RenderProblems())
84+
body = fmt.Sprintf("\n\n%s\n\n@%s our automated pre-checks have detected the following problems:\n\n%s\n\nUpdate this issue to correct these problems and we’ll automatically re-evaluate your application.", applicationData, issueAuthor, r.application.RenderProblems())
8485
}
8586

8687
r.gitHub.CreateIssueComment(fmt.Sprintf("%s%s", title, body))

0 commit comments

Comments
 (0)