• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

moosetechnology / GitProjectHealth / 13386705041

18 Feb 2025 08:53AM UTC coverage: 61.942% (-0.09%) from 62.03%
13386705041

Pull #132

github

web-flow
Merge e4e56b9c1 into 8ff2bbfd9
Pull Request #132: renaming all importer

965 of 2138 new or added lines in 18 files covered. (45.14%)

3 existing lines in 1 file now uncovered.

9624 of 15537 relevant lines covered (61.94%)

0.62 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

20.32
/src/GitHubHealth-Model-Importer/GithubModelImporter.class.st
1
Class {
2
        #name : #GithubModelImporter,
3
        #superclass : #GitModelImporter,
4
        #category : #'GitHubHealth-Model-Importer'
5
}
6

7
{ #category : #accessing }
NEW
8
GithubModelImporter >> api [
×
NEW
9

×
NEW
10
        self
×
NEW
11
                deprecated: 'Use #repoApi instead'
×
NEW
12
                on: '7 October 2024'
×
NEW
13
                in:
×
NEW
14
                'Pharo-11.0.0+build.726.sha.aece1b5473acf3830a0e082c1bc3a15d4ff3522b (64 Bit)'.
×
NEW
15

×
NEW
16
        ^ repoApi
×
NEW
17
]
×
18

19
{ #category : #accessing }
NEW
20
GithubModelImporter >> api: anObject [
×
NEW
21

×
NEW
22
        self
×
NEW
23
                deprecated: 'Use #repoApi: instead'
×
NEW
24
                on: '7 October 2024'
×
NEW
25
                in:
×
NEW
26
                'Pharo-11.0.0+build.726.sha.aece1b5473acf3830a0e082c1bc3a15d4ff3522b (64 Bit)'.
×
NEW
27

×
NEW
28
        repoApi := anObject
×
NEW
29
]
×
30

31
{ #category : #api }
NEW
32
GithubModelImporter >> completeImportProject: aGLHProject [
×
NEW
33

×
NEW
34
        self importPipelinesOf: aGLHProject.
×
NEW
35
        self importBranchesOf: aGLHProject.
×
NEW
36
        self withCommitsSince ifNotNil: [ :withCommitSince | "If not nil, it means we have to import commit"
×
NEW
37
                | commits |
×
NEW
38
                commits := self importCommitsOfProject: aGLHProject.
×
NEW
39
                self chainsCommitsFrom: commits ]
×
NEW
40
]
×
41

42
{ #category : #commit }
NEW
43
GithubModelImporter >> completeImportedCommit: aGLHCommit [
×
NEW
44

×
NEW
45
        | result |
×
NEW
46
        ('completing commit: ' , aGLHCommit short_id printString) recordInfo.
×
NEW
47
        "link commit to user"
×
NEW
48
        self importCreatorOfCommit: aGLHCommit.
×
NEW
49

×
NEW
50
        "import deletion and addition"
×
NEW
51
        result := self repoApi
×
NEW
52
                          commit: aGLHCommit id
×
NEW
53
                          ofOrganisation: aGLHCommit repository project group name
×
NEW
54
                          ofProject: aGLHCommit repository project name.
×
NEW
55
        aGLHCommit deletions:
×
NEW
56
                ((result at: #files) collect: [ :file | file at: #deletions ]) sum.
×
NEW
57
        aGLHCommit additions:
×
NEW
58
                ((result at: #files) collect: [ :file | file at: #additions ]) sum.
×
NEW
59

×
NEW
60

×
NEW
61
        "import diffs of this commits"
×
NEW
62
        self withCommitDiffs ifTrue: [
×
NEW
63
                | diffs |
×
NEW
64
                aGLHCommit diffs ifEmpty: [
×
NEW
65
                        diffs := self parseDiffresult: result.
×
NEW
66
                        diffs := aGLHCommit diffs
×
NEW
67
                                         addAll: diffs
×
NEW
68
                                         unless: self blockForDiffEquality.
×
NEW
69
                        self glhModel addAll: diffs unless: self blockForDiffEquality.
×
NEW
70
                        diffs do: [ :diff | self importDiffRangesForDiff: diff ] ] ].
×
NEW
71

×
NEW
72
        ^ aGLHCommit 
×
NEW
73
]
×
74

75
{ #category : #private }
NEW
76
GithubModelImporter >> convertApiFileAsFile: aAPIFile [
×
NEW
77

×
NEW
78
        aAPIFile type = 'dir' ifTrue: [ 
×
NEW
79
                ^ GLHFileDirectory new
×
NEW
80
                          name: aAPIFile name;
×
NEW
81
                          yourself ].
×
NEW
82
        ^ GLHFileBlob new
×
NEW
83
                  name: aAPIFile name;
×
NEW
84
                  yourself
×
NEW
85
]
×
86

87
{ #category : #api }
NEW
88
GithubModelImporter >> ensureGroupNamed: aGroupName [
×
NEW
89

×
NEW
90
        ^ self glhModel
×
NEW
91
                  detect: [ :a |
×
NEW
92
                  (a isKindOf: GLHGroup) and: [ a name = aGroupName ] ]
×
NEW
93
                  ifNone: [ self glhModel newGroupNamed: aGroupName ]
×
NEW
94
]
×
95

96
{ #category : #api }
NEW
97
GithubModelImporter >> importBranchesOf: project [
×
NEW
98

×
NEW
99
        "add the pipeline (actions runs) in the project"
×
NEW
100

×
NEW
101
        | branchesResult branches repository |
×
NEW
102
        branchesResult := self repoApi
×
NEW
103
                                  branchesOfRepo: project name
×
NEW
104
                                  ofOrganization: project group name.
×
NEW
105
        branches := self parseBranchesResult: branchesResult.
×
NEW
106
        self glhModel addAll: branches.
×
NEW
107
        repository := GLHRepository new.
×
NEW
108
        self glhModel add: repository.
×
NEW
109
        project repository: repository.
×
NEW
110
        branches do: [ :branch | 
×
NEW
111
                repository addBranch: branch.
×
NEW
112
                self withFiles ifTrue: [ self importFilesOfBranch: branch ] ]
×
NEW
113
]
×
114

115
{ #category : #api }
NEW
116
GithubModelImporter >> importCommitsOfProject: aGLHProject [
×
NEW
117

×
NEW
118
        | itemByPage foundCommits tmp pageNumber |
×
NEW
119
        itemByPage := 100.
×
NEW
120
        pageNumber := 1.
×
NEW
121
        ('Extract all commits of ' , aGLHProject name) recordInfo.
×
NEW
122
        foundCommits := OrderedCollection new.
×
NEW
123
        ('Extract commits from ' , foundCommits size printString , ' to '
×
NEW
124
         , (foundCommits size + itemByPage) printString) recordInfo.
×
NEW
125
        "also check that there is at least one commit with the error handling"
×
NEW
126
        [
×
NEW
127
        tmp := self parseCommitsResult: (self repoApi
×
NEW
128
                                commitsOfProject: aGLHProject name
×
NEW
129
                                ofOrganization: aGLHProject group name
×
NEW
130
                                since: self withCommitsSince
×
NEW
131
                                perPage: itemByPage
×
NEW
132
                                page: pageNumber) ]
×
NEW
133
                on: GHRepositoryEmptyError
×
NEW
134
                do: [ ^ {  } ].
×
NEW
135

×
NEW
136
        foundCommits addAll: tmp.
×
NEW
137
        [ tmp size = itemByPage ] whileTrue: [
×
NEW
138
                pageNumber := pageNumber + 1.
×
NEW
139
                ('Extract issues from ' , foundCommits size printString , ' to '
×
NEW
140
                 , (foundCommits size + itemByPage) printString) recordInfo.
×
NEW
141
                tmp := self parseCommitsResult: (self repoApi
×
NEW
142
                                        commitsOfProject: aGLHProject name
×
NEW
143
                                        ofOrganization: aGLHProject group name
×
NEW
144
                                        since: self withCommitsSince
×
NEW
145
                                        perPage: itemByPage
×
NEW
146
                                        page: pageNumber).
×
NEW
147
                foundCommits addAll: tmp ].
×
NEW
148

×
NEW
149
        "add the imported commits (unless they are already added to this repository)"
×
NEW
150
        aGLHProject repository commits
×
NEW
151
                addAll: foundCommits
×
NEW
152
                unless: [ :existing :new | existing id = new id ].
×
NEW
153
        "add the imported commits to the model unles they are already added to the model"
×
NEW
154
        ^ self glhModel
×
NEW
155
                  addAll: foundCommits
×
NEW
156
                  unless: [ :existing :new | existing id = new id ]
×
NEW
157
]
×
158

159
{ #category : #'import - commits' }
NEW
160
GithubModelImporter >> importCreatorOfCommit: aGLHCommit [ 
×
NEW
161
                | creator |
×
NEW
162
        (self glhModel allWithType: GLHUser)
×
NEW
163
                detect: [ :user | user username = aGLHCommit author_name ]
×
NEW
164
                ifFound: [ :user |
×
NEW
165
                        aGLHCommit commitCreator: user.
×
NEW
166
                        ^ user ].
×
NEW
167

×
NEW
168
        creator := self importUserByUsername: aGLHCommit author_name.
×
NEW
169
        aGLHCommit commitCreator: creator.
×
NEW
170
        ^ creator
×
NEW
171
]
×
172

173
{ #category : #api }
NEW
174
GithubModelImporter >> importDiffOfCommit: aGLHCommit [
×
NEW
175

×
NEW
176
        | result diffsResult |
×
NEW
177
        aGLHCommit diffs ifNotEmpty: [
×
NEW
178
                'Diff already importer: '
×
NEW
179
                , aGLHCommit short_id printString recordInfo.
×
NEW
180
                ^ aGLHCommit diffs ].
×
NEW
181
        ('Import diff of commit: ' , aGLHCommit short_id printString)
×
NEW
182
                recordInfo.
×
NEW
183
        result := self repoApi
×
NEW
184
                          commit: aGLHCommit id
×
NEW
185
                          ofOrganisation: aGLHCommit repository project group name
×
NEW
186
                          ofProject: aGLHCommit repository project name.
×
NEW
187
        diffsResult := self parseDiffresult: result.
×
NEW
188

×
NEW
189
        ^ aGLHCommit diffs
×
NEW
190
                  addAll: diffsResult
×
NEW
191
                  unless: self blockForDiffEquality
×
NEW
192
]
×
193

194
{ #category : #api }
NEW
195
GithubModelImporter >> importDirectoryFiles: aDirectoryFile OfBranch: aBranch [
×
NEW
196

×
NEW
197
        | result files apiFiles |
×
NEW
198
        ('Explore ' , aDirectoryFile name) recordInfo.
×
NEW
199
        result := self api
×
NEW
200
                          contentsOfRepo: aBranch repository project name
×
NEW
201
                          ofOrganization: aBranch repository project group name
×
NEW
202
                          inBranch: aBranch name
×
NEW
203
                          withPath: aDirectoryFile path.
×
NEW
204
        apiFiles := self parseFileTreeResult: result.
×
NEW
205
        files := apiFiles collect: [ :apiFile | 
×
NEW
206
                         self convertApiFileAsFile: apiFile ].
×
NEW
207
        files do: [ :file | 
×
NEW
208
                self glhModel add: file.
×
NEW
209
                aDirectoryFile addFile: file ].
×
NEW
210
        files
×
NEW
211
                select: [ :file | file isKindOf: GLHFileDirectory ]
×
NEW
212
                thenCollect: [ :file | 
×
NEW
213
                self importDirectoryFiles: file OfBranch: aBranch ]
×
NEW
214
]
×
215

216
{ #category : #api }
NEW
217
GithubModelImporter >> importFilesOfBranch: aBranch [
×
NEW
218

×
NEW
219
        | result files apiFiles |
×
NEW
220
        result := self api
×
NEW
221
                          contentsOfRepo: aBranch repository project name
×
NEW
222
                          ofOrganization: aBranch repository project group name
×
NEW
223
                          inBranch: aBranch name
×
NEW
224
                          withPath: nil.
×
NEW
225
        apiFiles := self parseFileTreeResult: result.
×
NEW
226
        files := apiFiles collect: [ :apiFile | 
×
NEW
227
                         self convertApiFileAsFile: apiFile ].
×
NEW
228
        files do: [ :file | 
×
NEW
229
                self glhModel add: file.
×
NEW
230
                aBranch addFile: file ].
×
NEW
231
        files
×
NEW
232
                select: [ :file | file isKindOf: GLHFileDirectory ]
×
NEW
233
                thenCollect: [ :file | 
×
NEW
234
                self importDirectoryFiles: file OfBranch: aBranch ]
×
NEW
235
]
×
236

237
{ #category : #api }
NEW
238
GithubModelImporter >> importGroup: aGroupName [
×
NEW
239

×
NEW
240
        | result groupResult |
×
NEW
241
        result := self repoApi organization: aGroupName.
×
NEW
242
        groupResult := self parseGroupResult: result.
×
NEW
243
        self glhModel add: groupResult.
×
NEW
244
        self importRepositoriesOfGroup: groupResult.
×
NEW
245
        ^ groupResult
×
NEW
246
]
×
247

248
{ #category : #'import - merge request' }
NEW
249
GithubModelImporter >> importMergeRequests: aProject [ 
×
NEW
250
        |response mergeRequests|
×
NEW
251
        response := self repoApi 
×
NEW
252
                        mergeRequestsOfRepo: aProject group name 
×
NEW
253
                        ofProject: aProject name.
×
NEW
254
        mergeRequests := self parseMergeRequestResult: response. 
×
NEW
255
        
×
NEW
256
        mergeRequests := aProject mergeRequests addAll:mergeRequests unless: self blockOnIdEquality.
×
NEW
257
        ^ mergeRequests
×
NEW
258
        
×
NEW
259
]
×
260

261
{ #category : #api }
NEW
262
GithubModelImporter >> importPipelinesOf: project [
×
NEW
263

×
NEW
264
        "add the pipeline (actions runs) in the project"
×
NEW
265

×
NEW
266
        | pipelinesResult ghApiPipelineOverview |
×
NEW
267
        pipelinesResult := self repoApi
×
NEW
268
                                   actionsRunOfRepo: project name
×
NEW
269
                                   ofOrganization: project group name.
×
NEW
270
        ghApiPipelineOverview := self parsePipelinesResult: pipelinesResult.
×
NEW
271
        ghApiPipelineOverview workflow_runs do: [ :pipeline | 
×
NEW
272
                project addPipeline: pipeline ]
×
NEW
273
]
×
274

275
{ #category : #api }
NEW
276
GithubModelImporter >> importProject: aProjectName ofGroup: aGroupName [
×
NEW
277

×
NEW
278
        | result projectResult group |
×
NEW
279
        group := self ensureGroupNamed: aGroupName.
×
NEW
280
        result := self repoApi organization: aGroupName repo: aProjectName.
×
NEW
281
        projectResult := self parseProjectResult: result.
×
NEW
282
        projectResult group: group.
×
NEW
283
        self glhModel add: projectResult.
×
NEW
284
        self completeImportProject: projectResult.
×
NEW
285
        ^ projectResult
×
NEW
286
]
×
287

288
{ #category : #api }
NEW
289
GithubModelImporter >> importRepositoriesOfGroup: groupResult [
×
NEW
290

×
NEW
291
        | reposResult itemByPage pageNumber reposFound tmp |
×
NEW
292
        itemByPage := 100.
×
NEW
293
        pageNumber := 1.
×
NEW
294
        ('Extract all repository of ' , groupResult name) recordInfo.
×
NEW
295
        reposFound := OrderedCollection new.
×
NEW
296
        ('Extract commits from ' , reposFound size printString , ' to '
×
NEW
297
         , (reposFound size + itemByPage) printString) recordInfo.
×
NEW
298
        tmp := self parseArrayOfProject: (self repoApi
×
NEW
299
                                reposOfOrganization: groupResult name
×
NEW
300
                                perPage: itemByPage
×
NEW
301
                                page: pageNumber).
×
NEW
302

×
NEW
303
        reposFound addAll: tmp.
×
NEW
304
        [ tmp size = itemByPage ] whileTrue: [
×
NEW
305
                pageNumber := pageNumber + 1.
×
NEW
306
                ('Extract issues from ' , reposFound size printString , ' to '
×
NEW
307
                 , (reposFound size + itemByPage) printString) recordInfo.
×
NEW
308
                tmp := self parseArrayOfProject: (self repoApi
×
NEW
309
                                        reposOfOrganization: groupResult name
×
NEW
310
                                        perPage: itemByPage
×
NEW
311
                                        page: pageNumber).
×
NEW
312
                reposFound addAll: tmp ].
×
NEW
313

×
NEW
314
        reposResult := self repoApi reposOfOrganization: groupResult name.
×
NEW
315
        groupResult projects addAll: reposFound.
×
NEW
316
        self glhModel addAll: groupResult projects.
×
NEW
317
        groupResult projects do: [ :project |
×
NEW
318
                self completeImportProject: project ].
×
NEW
319
        ^ groupResult
×
NEW
320
]
×
321

322
{ #category : #api }
NEW
323
GithubModelImporter >> importUser: userID [
×
NEW
324

×
NEW
325
        | result userResult |
×
NEW
326
        (glhModel allWithType: GLHUser)
×
NEW
327
                detect: [ :user | user id = userID ]
×
NEW
328
                ifFound: [ :user | ^ user ].
×
NEW
329
        ('Import user: ' , userID printString) recordInfo.
×
NEW
330
        result := self repoApi user: userID.
×
NEW
331
        userResult := self parseUserResult: result.
×
NEW
332
        ^ glhModel
×
NEW
333
                  add: userResult
×
NEW
334
                  unless: [ :current :new | current id = new id ]
×
NEW
335
]
×
336

337
{ #category : #initialization }
338
GithubModelImporter >> initialize [
1✔
339

1✔
340
        super initialize.
1✔
341
        self repoApi: GHApi new.
1✔
342
        self withCommitDiffs: false.
1✔
343
        withFiles := false
1✔
344
]
1✔
345

346
{ #category : #parsing }
NEW
347
GithubModelImporter >> parseArrayOfProject: arrayOfProjects [
×
NEW
348

×
NEW
349
        | reader |
×
NEW
350
        reader := NeoJSONReader on: arrayOfProjects readStream.
×
NEW
351
        reader
×
NEW
352
                for: #ArrayOfProjects
×
NEW
353
                customDo: [ :customMappting | 
×
NEW
354
                customMappting listOfElementSchema: GLHProject ].
×
NEW
355
        reader for: GLHProject do: [ :mapping | 
×
NEW
356
                mapping mapInstVar: #name to: #name.
×
NEW
357
                mapping mapInstVar: #description to: #description.
×
NEW
358
                mapping mapInstVar: #id to: #id.
×
NEW
359
                mapping mapInstVar: #archived to: #archived.
×
NEW
360
                mapping mapInstVar: #web_url to: #html_url.
×
NEW
361
                mapping mapInstVar: #topics to: #topics ].
×
NEW
362
        ^ reader nextAs: #ArrayOfProjects
×
NEW
363
]
×
364

365
{ #category : #parsing }
NEW
366
GithubModelImporter >> parseBranchesResult: arrayOfBranch [
×
NEW
367

×
NEW
368
        | reader |
×
NEW
369
        reader := NeoJSONReader on: arrayOfBranch readStream.
×
NEW
370
        reader mapInstVarsFor: GLHBranch.
×
NEW
371
        reader
×
NEW
372
                for: #ArrayOfBranch
×
NEW
373
                customDo: [ :customMappting | 
×
NEW
374
                customMappting listOfElementSchema: GLHBranch ].
×
NEW
375
        ^ reader nextAs: #ArrayOfBranch
×
NEW
376
]
×
377

378
{ #category : #parsing }
379
GithubModelImporter >> parseCommitsResult: result [
1✔
380

1✔
381
        | reader |
1✔
382
        (result includesSubstring: '"status":"409"') ifTrue: [
1✔
383
                GHRepositoryEmptyError signal: 'Git Repository is empty' ].
1✔
384

1✔
385
        reader := NeoJSONReader on: result readStream.
1✔
386

1✔
387
        reader for: GLHCommit do: [ :mapping |
1✔
388
                mapping mapInstVar: #id to: #sha.
1✔
389
                mapping mapInstVar: #web_url to: #html_url.
1✔
390

1✔
391
                mapping
1✔
392
                        mapProperty: #commit
1✔
393
                        getter: [ :object | #ignore ]
1✔
394
                        setter: [ :glhCommit :value |
1✔
395
                                glhCommit message: (value at: #message).
1✔
396
                                glhCommit authored_date:
1✔
397
                                        (DateAndTime fromString: (value at: #author at: #date)).
1✔
398
                                glhCommit committed_date:
1✔
399
                                        (DateAndTime fromString: (value at: #committer at: #date)) ].
1✔
400

1✔
401
                mapping
1✔
402
                        mapProperty: #author
1✔
403
                        getter: [ :object | #ignore ]
1✔
404
                        setter: [ :glhCommit :value |
1✔
405
                                value ifNotNil: [
1✔
406
                                        glhCommit author_name: (value at: #login).
1✔
407
                                        value
1✔
408
                                                at: #id
1✔
409
                                                ifPresent: [ :authorId |
1✔
410
                                                glhCommit commitCreator: (self importUser: authorId) ] ] ].
1✔
411

1✔
412
                mapping
1✔
413
                        mapProperty: #committer
1✔
414
                        getter: [ :object | #ignore ]
1✔
415
                        setter: [ :glhCommit :value |
1✔
416
                                value ifNotNil: [ glhCommit committer_name: (value at: #login) ] ].
1✔
417

1✔
418
                (mapping mapInstVar: #parent_ids to: #parents) valueSchema:
1✔
419
                        #ArrayOfIds ].
1✔
420

1✔
421
        reader for: DateAndTime customDo: [ :mapping |
1✔
422
                mapping decoder: [ :string | DateAndTime fromString: string ] ].
1✔
423

1✔
424
        reader for: #ArrayOfIds customDo: [ :mapping |
1✔
425
                mapping decoder: [ :parents |
1✔
426
                        parents collect: [ :parent | parent at: #sha ] ] ].
1✔
427

1✔
428
        reader
1✔
429
                for: #ArrayOfCommit
1✔
430
                customDo: [ :customMappting |
1✔
431
                customMappting listOfElementSchema: GLHCommit ].
1✔
432

1✔
433

1✔
434
        ^ reader nextAs: #ArrayOfCommit
1✔
435
]
1✔
436

437
{ #category : #parsing }
NEW
438
GithubModelImporter >> parseDiffresult: response [
×
NEW
439

×
NEW
440
        | result |
×
NEW
441
        result := (response at: #files) collect: [ :file |
×
NEW
442
                          GLHDiff new
×
NEW
443
                                  diffString: (file at: #patch);
×
NEW
444
                                  old_path: (file at: #filename);
×
NEW
445
                                  new_path: (file at: #filename) ].
×
NEW
446

×
NEW
447
        ^ result
×
NEW
448
]
×
449

450
{ #category : #parsing }
NEW
451
GithubModelImporter >> parseFileTreeResult: aResult [
×
NEW
452

×
NEW
453
        | reader |
×
NEW
454
        reader := NeoJSONReader on: aResult readStream.
×
NEW
455
        reader mapInstVarsFor: GHApiFile.
×
NEW
456
        reader
×
NEW
457
                for: #ArrayOfFile
×
NEW
458
                customDo: [ :customMappting | 
×
NEW
459
                customMappting listOfElementSchema: GHApiFile ].
×
NEW
460
        ^ reader nextAs: #ArrayOfFile
×
NEW
461
]
×
462

463
{ #category : #parsing }
NEW
464
GithubModelImporter >> parseGroupResult: aResult [
×
NEW
465

×
NEW
466
        | reader |
×
NEW
467
        reader := NeoJSONReader on: aResult readStream.
×
NEW
468
        reader for: GLHGroup do: [ :mapping | 
×
NEW
469
                mapping mapInstVar: #name to: #login.
×
NEW
470
                mapping mapInstVar: #description to: #description.
×
NEW
471
                mapping mapInstVar: #id to: #id.
×
NEW
472
                mapping mapInstVar: #web_url to: #html_url ].
×
NEW
473
        ^ reader nextAs: GLHGroup
×
NEW
474
]
×
475

476
{ #category : #parsing }
NEW
477
GithubModelImporter >> parseMergeRequestResult: response [
×
NEW
478

×
NEW
479
        | result |
×
NEW
480
        self flag: 'temp version, must remade using NeoJsonReader'.
×
NEW
481
        result := response collect: [ :aPull |
×
NEW
482
                          GLHMergeRequest new
×
NEW
483
                                  id: (aPull at: #id);
×
NEW
484
                                  title: (aPull at: #title);
×
NEW
485
                                  state: (aPull at: #state);
×
NEW
486
                                  closed_at:
×
NEW
487
                                          ((aPull at: #closed_at) ifNotNil: #asDateAndTime);
×
NEW
488
                                  merged_at:
×
NEW
489
                                          ((aPull at: #merged_at) ifNotNil: #asDateAndTime);
×
NEW
490
                                  updated_at:
×
NEW
491
                                          ((aPull at: #updated_at) ifNotNil: #asDateAndTime);
×
NEW
492
                                  created_at:
×
NEW
493
                                          ((aPull at: #created_at) ifNotNil: #asDateAndTime);
×
NEW
494
                                  sha: (aPull at: #head at: #sha);
×
NEW
495
                                  merge_commit_sha: (aPull at: #merge_commit_sha) ].
×
NEW
496
        result := self glhModel addAll: result unless: self blockOnIdEquality.
×
NEW
497
        ^ result
×
NEW
498
]
×
499

500
{ #category : #parsing }
501
GithubModelImporter >> parsePipelinesResult: pipelineOverview [
1✔
502

1✔
503
        | reader |
1✔
504
        reader := NeoJSONReader on: pipelineOverview readStream.
1✔
505
        reader for: GHAPIPipelineOverview do: [ :mapping |
1✔
506
                mapping mapInstVar: #total_count to: #total_count.
1✔
507
                (mapping mapInstVar: #workflow_runs) valueSchema: #ArrayOfPipelines ].
1✔
508
        reader
1✔
509
                for: #ArrayOfPipelines
1✔
510
                customDo: [ :customMappting |
1✔
511
                customMappting listOfElementSchema: GLHPipeline ].
1✔
512
        reader for: GLHPipeline do: [ :mapping |
1✔
513
                mapping
1✔
514
                        mapInstVar: #status to: #conclusion;
1✔
515
                        mapProperty: #run_started_at
1✔
516
                        getter: [ :object | #ignore ]
1✔
517
                        setter: [ :object :value |
1✔
518
                                object runDate: (DateAndTime fromString: value) ] ].
1✔
519
        ^ reader nextAs: GHAPIPipelineOverview
1✔
520
]
1✔
521

522
{ #category : #parsing }
NEW
523
GithubModelImporter >> parseProjectResult: aResult [
×
NEW
524

×
NEW
525
        | reader |
×
NEW
526
        reader := NeoJSONReader on: aResult readStream.
×
NEW
527
        reader for: GLHProject do: [ :mapping |
×
NEW
528
                mapping mapInstVar: #name to: #name.
×
NEW
529
                mapping mapInstVar: #description to: #description.
×
NEW
530
                mapping mapInstVar: #id to: #id.
×
NEW
531
                mapping mapInstVar: #archived to: #archived.
×
NEW
532
                mapping mapInstVar: #web_url to: #html_url.
×
NEW
533
                mapping mapInstVar: #topics to: #topics ].
×
NEW
534
        ^ reader nextAs: GLHProject
×
NEW
535
]
×
536

537
{ #category : #parsing }
538
GithubModelImporter >> parseUserResult: result [
1✔
539

1✔
540
        | reader |
1✔
541
        reader := NeoJSONReader on: result readStream.
1✔
542
        reader for: GLHUser do: [ :mapping |
1✔
543
                mapping mapInstVar: #id to: #id.
1✔
544
                mapping mapInstVar: #public_email to: #email.
1✔
545
                mapping mapInstVar: #username to: #login.
1✔
546
                mapping mapInstVar: #bio to: #bio.
1✔
547
                mapping mapInstVar: #organization to: #company.
1✔
548
                mapping mapInstVar: #followers to: #followers.
1✔
549
                mapping mapInstVar: #following to: #following.
1✔
550
                mapping mapInstVar: #web_url to: #html_url.
1✔
551
                mapping mapInstVar: #name to: #name.
1✔
552
                mapping mapInstVar: #avatar_url to: #avatar_url ].
1✔
553
        ^ reader nextAs: GLHUser
1✔
554
]
1✔
555

556
{ #category : #api }
NEW
557
GithubModelImporter >> privateToken [
×
NEW
558
        ^ self api privateToken
×
NEW
559
]
×
560

561
{ #category : #api }
NEW
562
GithubModelImporter >> privateToken: aTokenString [
×
NEW
563
        ^ self repoApi privateToken: aTokenString
×
NEW
564
]
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc