MCPcopy Index your code
hub / github.com/1Password/for-open-source / updateLabels

Method updateLabels

script/reviewer.go:94–136  ·  view source on GitHub ↗
(status Status, isClosed bool)

Source from the content-addressed store, hash-verified

92}
93
94func (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
138func (r *Reviewer) logErrorAndExit(message string, err error) {
139 sentry.CaptureException(err)

Callers 1

ReviewMethod · 0.95

Calls 4

logErrorAndExitMethod · 0.95
IsValidMethod · 0.80
RemoveIssueLabelMethod · 0.80
AddIssueLabelMethod · 0.80

Tested by

no test coverage detected