@@ -40,6 +40,8 @@ func NewClient(httpClient *http.Client, username string, password string, atlant
40
40
}
41
41
}
42
42
43
+ var MY_UUID = ""
44
+
43
45
// GetModifiedFiles returns the names of files that were modified in the merge request
44
46
// relative to the repo root, e.g. parent/child/file.txt.
45
47
func (b * Client ) GetModifiedFiles (logger logging.SimpleLogging , repo models.Repo , pull models.PullRequest ) ([]string , error ) {
@@ -134,7 +136,10 @@ func (b *Client) HidePrevCommandComments(logger logging.SimpleLogging, repo mode
134
136
if strings .Contains (firstLine , strings .ToLower (command )) {
135
137
// we found our old comment that references that command
136
138
logger .Debug ("Deleting comment with id %s" , * c .ID )
137
- b .DeletePullRequestComment (repo , pullNum , * c .ID )
139
+ err = b .DeletePullRequestComment (repo , pullNum , * c .ID )
140
+ if err != nil {
141
+ return err
142
+ }
138
143
}
139
144
}
140
145
}
@@ -165,25 +170,30 @@ func (b *Client) GetPullRequestComments(repo models.Repo, pullNum int) (comments
165
170
}
166
171
167
172
func (b * Client ) GetMyUUID () (uuid string , err error ) {
168
- path := fmt .Sprintf ("%s/2.0/user" , b .BaseURL )
169
- resp , err := b .makeRequest ("GET" , path , nil )
173
+ if MY_UUID == "" {
174
+ path := fmt .Sprintf ("%s/2.0/user" , b .BaseURL )
175
+ resp , err := b .makeRequest ("GET" , path , nil )
170
176
171
- if err != nil {
172
- return uuid , err
173
- }
177
+ if err != nil {
178
+ return uuid , err
179
+ }
174
180
175
- var user User
176
- if err := json .Unmarshal (resp , & user ); err != nil {
177
- return uuid , errors .Wrapf (err , "Could not parse response %q" , string (resp ))
178
- }
181
+ var user User
182
+ if err := json .Unmarshal (resp , & user ); err != nil {
183
+ return uuid , errors .Wrapf (err , "Could not parse response %q" , string (resp ))
184
+ }
179
185
180
- if err := validator .New ().Struct (user ); err != nil {
181
- return uuid , errors .Wrapf (err , "API response %q was missing a field" , string (resp ))
182
- }
186
+ if err := validator .New ().Struct (user ); err != nil {
187
+ return uuid , errors .Wrapf (err , "API response %q was missing a field" , string (resp ))
188
+ }
183
189
184
- uuid = * user .UUID
185
- return uuid , nil
190
+ uuid = * user .UUID
191
+ MY_UUID = uuid
186
192
193
+ return uuid , nil
194
+ } else {
195
+ return MY_UUID , nil
196
+ }
187
197
}
188
198
189
199
// PullIsApproved returns true if the merge request was approved.
0 commit comments