(status Status, isClosed bool, issueAuthor string)
| 53 | } |
| 54 | |
| 55 | func (r *Reviewer) createComment(status Status, isClosed bool, issueAuthor string) { |
| 56 | title := "" |
| 57 | body := "" |
| 58 | |
| 59 | applicationData := fmt.Sprintf("<details>\n<summary>Application data...</summary>\n\n```json\n%s\n```\n</details>", r.application.GetData()) |
| 60 | applicationFilePath := fmt.Sprintf("https://github.com/1Password/1password-teams-open-source/blob/main/data/%s", r.application.FileName()) |
| 61 | contactSnippet := "If you have any questions or this is an error, contact us at [opensource@1password.com](mailto:opensource@1password.com)." |
| 62 | 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). %s", issueAuthor, applicationFilePath, contactSnippet) |
| 63 | closedBody := fmt.Sprintf("@%s this application is closed and changes will not be reviewed. %s", issueAuthor, contactSnippet) |
| 64 | |
| 65 | // If the issue is closed, let the user know that they can't make changes. |
| 66 | // If the issue was closed because it got approved, let them know how they can |
| 67 | // modify their application details after the fact. |
| 68 | if isClosed { |
| 69 | if status == Approved { |
| 70 | body = approvedBody |
| 71 | } else { |
| 72 | body = closedBody |
| 73 | } |
| 74 | // This scanerio should never occur, as an approved issue should |
| 75 | // immediately be closed, but let's cover all bases. |
| 76 | } else if status == Approved { |
| 77 | body = approvedBody |
| 78 | } else if r.application.IsValid() { |
| 79 | if status == Reviewing { |
| 80 | title = "### 👍 Application still valid" |
| 81 | 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) |
| 82 | } else { |
| 83 | title = "### ✅ Your application is valid" |
| 84 | 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) |
| 85 | } |
| 86 | } else { |
| 87 | title = "### ❌ Your application is invalid" |
| 88 | 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. %s", applicationData, issueAuthor, r.application.RenderProblems(), contactSnippet) |
| 89 | } |
| 90 | |
| 91 | r.gitHub.CreateIssueComment(fmt.Sprintf("%s%s", title, body)) |
| 92 | } |
| 93 | |
| 94 | func (r *Reviewer) updateLabels(status Status, isClosed bool) { |
| 95 | if status == Approved || isClosed { |
no test coverage detected