(status Status, isClosed bool)
| 92 | } |
| 93 | |
| 94 | func (r *Reviewer) updateLabels(status Status, isClosed bool) { |
| 95 | if status == Approved || isClosed { |
| 96 | return |
| 97 | } |
| 98 | |
| 99 | if r.application.IsValid() { |
| 100 | if status == Invalid { |
| 101 | if err := r.gitHub.RemoveIssueLabel(LabelStatusInvalid); err != nil { |
| 102 | r.logErrorAndExit( |
| 103 | fmt.Sprintf("could not remove issue label '%s'", LabelStatusInvalid), |
| 104 | err, |
| 105 | ) |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | if status != Reviewing { |
| 110 | if err := r.gitHub.AddIssueLabel(LabelStatusReviewing); err != nil { |
| 111 | r.logErrorAndExit( |
| 112 | fmt.Sprintf("could not add issue label '%s'", LabelStatusReviewing), |
| 113 | err, |
| 114 | ) |
| 115 | } |
| 116 | } |
| 117 | } else { |
| 118 | if status != Invalid { |
| 119 | if err := r.gitHub.AddIssueLabel(LabelStatusInvalid); err != nil { |
| 120 | r.logErrorAndExit( |
| 121 | fmt.Sprintf("could not add issue label '%s'", LabelStatusInvalid), |
| 122 | err, |
| 123 | ) |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | if status == Reviewing { |
| 128 | if err := r.gitHub.RemoveIssueLabel(LabelStatusReviewing); err != nil { |
| 129 | r.logErrorAndExit( |
| 130 | fmt.Sprintf("could not remove issue label '%s'", LabelStatusReviewing), |
| 131 | err, |
| 132 | ) |
| 133 | } |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | func (r *Reviewer) logErrorAndExit(message string, err error) { |
| 139 | sentry.CaptureException(err) |
no test coverage detected