@@ -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 ) {
@@ -165,25 +167,30 @@ func (b *Client) GetPullRequestComments(repo models.Repo, pullNum int) (comments
165
167
}
166
168
167
169
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 )
170
+ if MY_UUID == "" {
171
+ path := fmt .Sprintf ("%s/2.0/user" , b .BaseURL )
172
+ resp , err := b .makeRequest ("GET" , path , nil )
170
173
171
- if err != nil {
172
- return uuid , err
173
- }
174
+ if err != nil {
175
+ return uuid , err
176
+ }
174
177
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
- }
178
+ var user User
179
+ if err := json .Unmarshal (resp , & user ); err != nil {
180
+ return uuid , errors .Wrapf (err , "Could not parse response %q" , string (resp ))
181
+ }
179
182
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
- }
183
+ if err := validator .New ().Struct (user ); err != nil {
184
+ return uuid , errors .Wrapf (err , "API response %q was missing a field" , string (resp ))
185
+ }
183
186
184
- uuid = * user .UUID
185
- return uuid , nil
187
+ uuid = * user .UUID
188
+ MY_UUID = uuid
186
189
190
+ return uuid , nil
191
+ } else {
192
+ return MY_UUID , nil
193
+ }
187
194
}
188
195
189
196
// PullIsApproved returns true if the merge request was approved.
0 commit comments