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

moosetechnology / GitProjectHealth / 17852906108

19 Sep 2025 08:25AM UTC coverage: 74.019% (+0.7%) from 73.342%
17852906108

Pull #232

github

web-flow
Merge e5fac281b into dd8ffa1f6
Pull Request #232: add constructor in class since of GitModelImporter for quality of life setup

49 of 147 new or added lines in 8 files covered. (33.33%)

45 existing lines in 3 files now uncovered.

18909 of 25546 relevant lines covered (74.02%)

0.74 hits per line

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

70.1
/src/GitHubHealth-Model-Importer/GithubModelImporter.class.st
1
Class {
2
        #name : #GithubModelImporter,
3
        #superclass : #GitModelImporter,
4
        #instVars : [
5
                'generalReader'
6
        ],
7
        #category : #'GitHubHealth-Model-Importer'
8
}
9

10
{ #category : #accessing }
11
GithubModelImporter >> api [
×
12

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

×
19
        ^ repoApi
×
20
]
×
21

22
{ #category : #accessing }
23
GithubModelImporter >> api: anObject [
×
24

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

×
31
        repoApi := anObject
×
32
]
×
33

34
{ #category : #commit }
35
GithubModelImporter >> completeImportedCommit: aGLHCommit [
×
36

×
37
        | result |
×
38
        ('completing commit: ' , aGLHCommit short_id printString) recordInfo.
×
39
        "link commit to user"
×
40
        self importCreatorOfCommit: aGLHCommit.
×
41

×
42
        "import deletion and addition"
×
43
        result := self repoApi
×
44
                          commit: aGLHCommit id
×
45
                          ofOrganisation: aGLHCommit repository project group name
×
46
                          ofProject: aGLHCommit repository project name.
×
47
        aGLHCommit deletions:
×
48
                ((result at: #files) collect: [ :file | file at: #deletions ]) sum.
×
49
        aGLHCommit additions:
×
50
                ((result at: #files) collect: [ :file | file at: #additions ]) sum.
×
51

×
52

×
53
        "import diffs of this commits"
×
54
        self withCommitDiffs ifTrue: [
×
55
                | diffs |
×
56
                aGLHCommit diffs ifEmpty: [
×
57
                        diffs := self parseDiffresult: result.
×
58
                        diffs := aGLHCommit diffs
×
59
                                         addAll: diffs
×
60
                                         unless: self blockForDiffEquality.
×
61
                        self glhModel addAll: diffs unless: self blockForDiffEquality.
×
62
                        diffs do: [ :diff | self importDiffRangesForDiff: diff ] ] ].
×
63

×
64
        ^ aGLHCommit 
×
65
]
×
66

67
{ #category : #api }
68
GithubModelImporter >> completeImportedProject: aGLHProject [
×
69

×
70
        self importPipelinesOf: aGLHProject.
×
71
        self importBranchesOf: aGLHProject.
×
72
        self withCommitsSince ifNotNil: [ :withCommitSince | "If not nil, it means we have to import commit"
×
73
                | commits |
×
74
                commits := self importCommitsOfProject: aGLHProject.
×
75
                self chainsCommitsFrom: commits ]
×
76
]
×
77

78
{ #category : #'as yet unclassified' }
79
GithubModelImporter >> configureReaderForProject: reader [
1✔
80

1✔
81
"        reader mapInstVarsFor: GLHProject. "
1✔
82

1✔
83
        reader for: GLHProject do: [ :mapping | 
1✔
84
                mapping mapInstVar: #name to: #name.
1✔
85
                mapping mapInstVar: #description to: #description.
1✔
86
                mapping mapInstVar: #id to: #id.
1✔
87
                mapping mapInstVar: #archived to: #archived.
1✔
88
                mapping mapInstVar: #web_url to: #html_url.
1✔
89
                mapping mapInstVar: #topics to: #topics ].
1✔
90

1✔
91
        reader
1✔
92
                for: #ArrayOfProjects 
1✔
93
                customDo: [ :customMappting |
1✔
94
                customMappting listOfElementSchema: GLHProject ].
1✔
95
]
1✔
96

1✔
97
{ #category : #private }
1✔
98
GithubModelImporter >> convertApiFileAsFile: aAPIFile [
1✔
99

1✔
100
        aAPIFile type = 'dir' ifTrue: [ 
1✔
101
                ^ GLHFileDirectory new
1✔
102
                          name: aAPIFile name;
1✔
103
                          yourself ].
1✔
104
        ^ GLHFileBlob new
1✔
105
                  name: aAPIFile name;
1✔
106
                  yourself
1✔
107
]
1✔
108

1✔
109
{ #category : #api }
1✔
110
GithubModelImporter >> ensureGroupNamed: aGroupName [
1✔
111

1✔
112
        ^ self glhModel
1✔
113
                  detect: [ :a |
1✔
114
                  (a isKindOf: GLHGroup) and: [ a name = aGroupName ] ]
1✔
115
                  ifNone: [ self glhModel newGroupNamed: aGroupName ]
1✔
116
]
1✔
117

1✔
118
{ #category : #'import - repositories' }
1✔
119
GithubModelImporter >> importBranchesOf: project [
1✔
120

1✔
121
        "add the pipeline (actions runs) in the project"
1✔
122

1✔
123
        | branchesResult branches repository |
1✔
124
        branchesResult := self repoApi
1✔
125
                                  branchesOfRepo: project name
1✔
126
                                  ofOrganization: project group name.
1✔
127
        branches := self parseBranchesResult: branchesResult.
1✔
128
        self glhModel addAll: branches.
1✔
129
        repository := GLHRepository new.
1✔
130
        self glhModel add: repository.
1✔
131
        project repository: repository.
1✔
132
        branches do: [ :branch | 
1✔
133
                repository addBranch: branch.
1✔
134
                self withFiles ifTrue: [ self importFilesOfBranch: branch ] ]
1✔
135
]
1✔
136

1✔
137
{ #category : #api }
1✔
138
GithubModelImporter >> importCommitsOfProject: aGLHProject [
1✔
139

1✔
140
        | itemByPage foundCommits tmp pageNumber |
1✔
141
        itemByPage := 100.
1✔
142
        pageNumber := 1.
1✔
143
        ('Extract all commits of ' , aGLHProject name) recordInfo.
1✔
144
        foundCommits := OrderedCollection new.
1✔
145
        ('Extract commits from ' , foundCommits size printString , ' to '
1✔
146
         , (foundCommits size + itemByPage) printString) recordInfo.
1✔
147
        "also check that there is at least one commit with the error handling"
1✔
148
        [
1✔
149
        tmp := self parseCommitsResult: (self repoApi
1✔
150
                                commitsOfProject: aGLHProject name
1✔
151
                                ofOrganization: aGLHProject group name
1✔
152
                                since: self withCommitsSince
1✔
153
                                perPage: itemByPage
1✔
154
                                page: pageNumber) ]
1✔
155
                on: GHRepositoryEmptyError
1✔
156
                do: [ ^ {  } ].
1✔
157

1✔
158
        foundCommits addAll: tmp.
1✔
159
        [ tmp size = itemByPage ] whileTrue: [
1✔
160
                pageNumber := pageNumber + 1.
1✔
161
                ('Extract issues from ' , foundCommits size printString , ' to '
1✔
162
                 , (foundCommits size + itemByPage) printString) recordInfo.
1✔
163
                tmp := self parseCommitsResult: (self repoApi
1✔
164
                                        commitsOfProject: aGLHProject name
1✔
165
                                        ofOrganization: aGLHProject group name
1✔
166
                                        since: self withCommitsSince
1✔
167
                                        perPage: itemByPage
1✔
168
                                        page: pageNumber).
1✔
169
                foundCommits addAll: tmp ].
1✔
170

1✔
171
        "add the imported commits (unless they are already added to this repository)"
1✔
172
        aGLHProject repository commits
1✔
173
                addAll: foundCommits
1✔
174
                unless: [ :existing :new | existing id = new id ].
1✔
175
        "add the imported commits to the model unles they are already added to the model"
1✔
176
        ^ self glhModel
1✔
177
                  addAll: foundCommits
1✔
178
                  unless: [ :existing :new | existing id = new id ]
1✔
179
]
1✔
180

1✔
181
{ #category : #'import - commits' }
1✔
182
GithubModelImporter >> importCreatorOfCommit: aGLHCommit [
1✔
183

1✔
184
        | creator |
1✔
185
        (self glhModel allWithType: GLHUser)
1✔
186
                detect: [ :user | user username = aGLHCommit author_name ]
1✔
187
                ifFound: [ :user |
1✔
188
                        aGLHCommit commitCreator: user.
1✔
189
                        ^ user ].
1✔
190

1✔
191
        aGLHCommit author_name ifNotNil: [ :author_name |
1✔
192
                creator := self importUserByUsername: author_name.
1✔
193
                aGLHCommit commitCreator: creator ].
1✔
194
        ^ creator
1✔
195
]
1✔
196

1✔
197
{ #category : #api }
1✔
198
GithubModelImporter >> importDiffOfCommit: aGLHCommit [
1✔
199

1✔
200
        | result diffsResult |
1✔
201
        aGLHCommit diffs ifNotEmpty: [
1✔
202
                'Diff already importer: '
1✔
203
                , aGLHCommit short_id printString recordInfo.
1✔
204
                ^ aGLHCommit diffs ].
1✔
205
        ('Import diff of commit: ' , aGLHCommit short_id printString)
1✔
206
                recordInfo.
1✔
207
        result := self repoApi
1✔
208
                          commit: aGLHCommit id
1✔
209
                          ofOrganisation: aGLHCommit repository project group name
1✔
210
                          ofProject: aGLHCommit repository project name.
1✔
211
        diffsResult := self parseDiffresult: result.
1✔
212

1✔
213
        ^ aGLHCommit diffs
1✔
214
                  addAll: diffsResult
1✔
215
                  unless: self blockForDiffEquality
1✔
216
]
1✔
217

1✔
218
{ #category : #api }
1✔
219
GithubModelImporter >> importDirectoryFiles: aDirectoryFile OfBranch: aBranch [
1✔
220

1✔
221
        | result files apiFiles |
1✔
222
        ('Explore ' , aDirectoryFile name) recordInfo.
1✔
223
        result := self api
1✔
224
                          contentsOfRepo: aBranch repository project name
1✔
225
                          ofOrganization: aBranch repository project group name
1✔
226
                          inBranch: aBranch name
1✔
227
                          withPath: aDirectoryFile path.
1✔
228
        apiFiles := self parseFileTreeResult: result.
1✔
229
        files := apiFiles collect: [ :apiFile | 
1✔
230
                         self convertApiFileAsFile: apiFile ].
1✔
231
        files do: [ :file | 
1✔
232
                self glhModel add: file.
1✔
233
                aDirectoryFile addFile: file ].
1✔
234
        files
1✔
235
                select: [ :file | file isKindOf: GLHFileDirectory ]
1✔
236
                thenCollect: [ :file | 
1✔
237
                self importDirectoryFiles: file OfBranch: aBranch ]
1✔
238
]
1✔
239

1✔
240
{ #category : #api }
1✔
241
GithubModelImporter >> importFilesOfBranch: aBranch [
1✔
242

1✔
243
        | result files apiFiles |
1✔
244
        result := self api
1✔
245
                          contentsOfRepo: aBranch repository project name
1✔
246
                          ofOrganization: aBranch repository project group name
1✔
247
                          inBranch: aBranch name
1✔
248
                          withPath: nil.
1✔
249
        apiFiles := self parseFileTreeResult: result.
1✔
250
        files := apiFiles collect: [ :apiFile | 
1✔
251
                         self convertApiFileAsFile: apiFile ].
1✔
252
        files do: [ :file | 
1✔
253
                self glhModel add: file.
1✔
254
                aBranch addFile: file ].
1✔
255
        files
1✔
256
                select: [ :file | file isKindOf: GLHFileDirectory ]
1✔
257
                thenCollect: [ :file | 
1✔
258
                self importDirectoryFiles: file OfBranch: aBranch ].
1✔
259
        ^ files
1✔
260
]
1✔
261

1✔
262
{ #category : #api }
1✔
263
GithubModelImporter >> importGroup: aGroupName [
1✔
264

1✔
265
        | result groupResult |
1✔
266
        result := self repoApi organization: aGroupName.
1✔
267
        groupResult := self parseGroupResult: result.
1✔
268
        self glhModel add: groupResult.
1✔
269
        self importRepositoriesOfGroup: groupResult.
1✔
270
        ^ groupResult
1✔
271
]
1✔
272

1✔
273
{ #category : #'import - merge request' }
1✔
274
GithubModelImporter >> importMergeRequests: aProject [ 
1✔
275
        |response mergeRequests|
1✔
276
        response := self repoApi 
1✔
277
                        mergeRequestsOfRepo: aProject group name 
1✔
278
                        ofProject: aProject name.
1✔
279
        mergeRequests := self parseMergeRequestsResult: response. 
1✔
280
        
1✔
281
        mergeRequests := aProject mergeRequests addAll:mergeRequests unless: self blockOnIdEquality.
1✔
282
        ^ mergeRequests
1✔
283
        
1✔
284
]
1✔
285

1✔
286
{ #category : #api }
1✔
287
GithubModelImporter >> importPipelinesOf: project [
1✔
288

1✔
289
        "add the pipeline (actions runs) in the project"
1✔
290

1✔
291
        | pipelinesResult ghApiPipelineOverview |
1✔
292
        pipelinesResult := self repoApi
1✔
293
                                   actionsRunOfRepo: project name
1✔
294
                                   ofOrganization: project group name.
1✔
295
        ghApiPipelineOverview := self parsePipelinesResult: pipelinesResult.
1✔
296
        ghApiPipelineOverview workflow_runs do: [ :pipeline | 
1✔
297
                project addPipeline: pipeline ]
1✔
298
]
1✔
299

1✔
300
{ #category : #api }
1✔
301
GithubModelImporter >> importProject: aProjectName ofGroup: aGroupName [
1✔
302

1✔
303
        | result projectResult group |
1✔
304
        group := self ensureGroupNamed: aGroupName.
1✔
305
        result := self repoApi organization: aGroupName repo: aProjectName.
1✔
306
        projectResult := self parseProjectResult: result.
1✔
307
        projectResult group: group.
1✔
308
        self glhModel add: projectResult.
1✔
309
        self completeImportedProject: projectResult.
1✔
310
        ^ projectResult
1✔
311
]
1✔
312

1✔
313
{ #category : #api }
1✔
314
GithubModelImporter >> importRepositoriesOfGroup: groupResult [
1✔
315

1✔
316
        | reposResult itemByPage pageNumber reposFound tmp |
1✔
317
        itemByPage := 100.
1✔
318
        pageNumber := 1.
1✔
319
        ('Extract all repository of ' , groupResult name) recordInfo.
1✔
320
        reposFound := OrderedCollection new.
1✔
321
        ('Extract commits from ' , reposFound size printString , ' to '
1✔
322
         , (reposFound size + itemByPage) printString) recordInfo.
1✔
323
        tmp := self parseArrayOfProject: (self repoApi
1✔
324
                                reposOfOrganization: groupResult name
1✔
325
                                perPage: itemByPage
1✔
326
                                page: pageNumber).
1✔
327

1✔
328
        reposFound addAll: tmp.
1✔
329
        [ tmp size = itemByPage ] whileTrue: [
1✔
330
                pageNumber := pageNumber + 1.
1✔
331
                ('Extract issues from ' , reposFound size printString , ' to '
1✔
332
                 , (reposFound size + itemByPage) printString) recordInfo.
1✔
333
                tmp := self parseArrayOfProject: (self repoApi
1✔
334
                                        reposOfOrganization: groupResult name
1✔
335
                                        perPage: itemByPage
1✔
336
                                        page: pageNumber).
1✔
337
                reposFound addAll: tmp ].
1✔
338

1✔
339
        reposResult := self repoApi reposOfOrganization: groupResult name.
1✔
340
        groupResult projects addAll: reposFound.
1✔
341
        self glhModel addAll: groupResult projects.
1✔
342
        groupResult projects do: [ :project |
1✔
343
                self completeImportedProject: project ].
1✔
344
        ^ groupResult
1✔
345
]
1✔
346

1✔
347
{ #category : #api }
1✔
348
GithubModelImporter >> importUser: userID [
1✔
349

1✔
350
        | result userResult |
1✔
351
        (glhModel allWithType: GLHUser)
1✔
352
                detect: [ :user | user id = userID ]
1✔
353
                ifFound: [ :user | ^ user ].
1✔
354
        ('Import user: ' , userID printString) recordInfo.
1✔
355
        result := self repoApi user: userID.
1✔
356
        userResult := self parseUserResult: result.
1✔
357
        ^ glhModel
1✔
358
                  add: userResult
1✔
359
                  unless: [ :current :new | current id = new id ]
1✔
360
]
1✔
361

1✔
362
{ #category : #initialization }
1✔
363
GithubModelImporter >> initReader [
1✔
364

1✔
365
        generalReader := NeoJSONReader new.
1✔
366
        self configureReaderForProject: generalReader.
1✔
367
]
1✔
368

1✔
369
{ #category : #initialization }
1✔
370
GithubModelImporter >> initialize [
1✔
371

1✔
372
        super initialize.
1✔
373
        self repoApi: GithubApi new.
1✔
374
        self repoApi output: 'json'.
1✔
375
        self withCommitDiffs: false.
1✔
376
        withFiles := false.
1✔
377
        
1✔
378
        self initReader
1✔
379
]
1✔
380

1✔
381
{ #category : #parsing }
1✔
382
GithubModelImporter >> parseArrayOfProject: arrayOfProjects [
1✔
383

1✔
384
        | reader |
1✔
385
" reader := NeoJSONReader on: arrayOfProjects readStream.
1✔
386
        
1✔
387
        reader
1✔
388
                for: #ArrayOfProjects
1✔
389
                customDo: [ :customMappting | 
1✔
390
                customMappting listOfElementSchema: GLHProject ].
1✔
391
        
1✔
392
        reader for: GLHProject do: [ :mapping | 
1✔
393
                mapping mapInstVar: #name to: #name.
1✔
394
                mapping mapInstVar: #description to: #description.
1✔
395
                mapping mapInstVar: #id to: #id.
1✔
396
                mapping mapInstVar: #archived to: #archived.
1✔
397
                mapping mapInstVar: #web_url to: #html_url.
1✔
398
                mapping mapInstVar: #topics to: #topics ].
1✔
399
        ^ reader nextAs: #ArrayOfProjects
1✔
400
        "
1✔
401

1✔
402
        reader := generalReader on: arrayOfProjects readStream.
1✔
403
        
1✔
404
        ^ reader nextAs: #ArrayOfProjects
1✔
405
]
1✔
406

407
{ #category : #parsing }
408
GithubModelImporter >> parseBranchesResult: arrayOfBranch [
×
409

×
410
        | reader |
×
411
        reader := NeoJSONReader on: arrayOfBranch readStream.
×
412
        reader mapInstVarsFor: GLHBranch.
×
413
        reader
×
414
                for: #ArrayOfBranch
×
415
                customDo: [ :customMappting | 
×
416
                customMappting listOfElementSchema: GLHBranch ].
×
417
        ^ reader nextAs: #ArrayOfBranch
×
418
]
×
419

420
{ #category : #parsing }
421
GithubModelImporter >> parseCommitsResult: result [
1✔
422

1✔
423
        | reader |
1✔
424
        (result includesSubstring: '"status":"409"') ifTrue: [
1✔
425
                GHRepositoryEmptyError signal: 'Git Repository is empty' ].
1✔
426

1✔
427
        reader := NeoJSONReader on: result readStream.
1✔
428

1✔
429
        reader for: GLHCommit do: [ :mapping |
1✔
430
                mapping mapInstVar: #id to: #sha.
1✔
431
                mapping mapInstVar: #web_url to: #html_url.
1✔
432

1✔
433
                mapping
1✔
434
                        mapProperty: #commit
1✔
435
                        getter: [ :object | #ignore ]
1✔
436
                        setter: [ :glhCommit :value |
1✔
437
                                glhCommit message: (value at: #message).
1✔
438
                                glhCommit authored_date:
1✔
439
                                        (DateAndTime fromString: (value at: #author at: #date)).
1✔
440
                                glhCommit committed_date:
1✔
441
                                        (DateAndTime fromString: (value at: #committer at: #date)) ].
1✔
442

1✔
443
                mapping
1✔
444
                        mapProperty: #author
1✔
445
                        getter: [ :object | #ignore ]
1✔
446
                        setter: [ :glhCommit :value |
1✔
447
                                value ifNotNil: [
1✔
448
                                        glhCommit author_name: (value at: #login).
1✔
449
                                        value
1✔
450
                                                at: #id
1✔
451
                                                ifPresent: [ :authorId |
1✔
452
                                                glhCommit commitCreator: (self importUser: authorId) ] ] ].
1✔
453

1✔
454
                mapping
1✔
455
                        mapProperty: #committer
1✔
456
                        getter: [ :object | #ignore ]
1✔
457
                        setter: [ :glhCommit :value |
1✔
458
                                value ifNotNil: [ glhCommit committer_name: (value at: #login) ] ].
1✔
459

1✔
460
                (mapping mapInstVar: #parent_ids to: #parents) valueSchema:
1✔
461
                        #ArrayOfIds ].
1✔
462

1✔
463
        reader for: DateAndTime customDo: [ :mapping |
1✔
464
                mapping decoder: [ :string | DateAndTime fromString: string ] ].
1✔
465

1✔
466
        reader for: #ArrayOfIds customDo: [ :mapping |
1✔
467
                mapping decoder: [ :parents |
1✔
468
                        parents collect: [ :parent | parent at: #sha ] ] ].
1✔
469

1✔
470
        reader
1✔
471
                for: #ArrayOfCommit
1✔
472
                customDo: [ :customMappting |
1✔
473
                customMappting listOfElementSchema: GLHCommit ].
1✔
474

1✔
475

1✔
476
        ^ reader nextAs: #ArrayOfCommit
1✔
477
]
1✔
478

479
{ #category : #parsing }
480
GithubModelImporter >> parseDiffresult: response [
×
481

×
482
        | result |
×
483
        result := (response at: #files) collect: [ :file |
×
484
                          GLHDiff new
×
485
                                  diffString: (file at: #patch);
×
486
                                  old_path: (file at: #filename);
×
487
                                  new_path: (file at: #filename) ].
×
488

×
489
        ^ result
×
490
]
×
491

492
{ #category : #parsing }
493
GithubModelImporter >> parseFileTreeResult: aResult [
×
494

×
495
        | reader |
×
496
        reader := NeoJSONReader on: aResult readStream.
×
497
        reader mapInstVarsFor: GHApiFile.
×
498
        reader
×
499
                for: #ArrayOfFile
×
500
                customDo: [ :customMappting | 
×
501
                customMappting listOfElementSchema: GHApiFile ].
×
502
        ^ reader nextAs: #ArrayOfFile
×
503
]
×
504

505
{ #category : #parsing }
506
GithubModelImporter >> parseGroupResult: aResult [
×
507

×
508
        | reader |
×
509
        reader := NeoJSONReader on: aResult readStream.
×
510
        reader for: GLHGroup do: [ :mapping | 
×
511
                mapping mapInstVar: #name to: #login.
×
512
                mapping mapInstVar: #description to: #description.
×
513
                mapping mapInstVar: #id to: #id.
×
514
                mapping mapInstVar: #web_url to: #html_url ].
×
515
        ^ reader nextAs: GLHGroup
×
516
]
×
517

518
{ #category : #parsing }
519
GithubModelImporter >> parseMergeRequestsResult: response [
×
520

×
521
        | result json|
×
522
        self flag: 'temp version, must remade using NeoJsonReader'.
×
523
        json := NeoJSONReader fromString: response.
×
524
        
×
525
        result := json collect: [ :aPull |
×
526
                          GLHMergeRequest new
×
527
                                  id: (aPull at: #id);
×
528
                                  title: (aPull at: #title);
×
529
                                  state: (aPull at: #state);
×
530
                                  closed_at:
×
531
                                          ((aPull at: #closed_at) ifNotNil: #asDateAndTime);
×
532
                                  merged_at:
×
533
                                          ((aPull at: #merged_at) ifNotNil: #asDateAndTime);
×
534
                                  updated_at:
×
535
                                          ((aPull at: #updated_at) ifNotNil: #asDateAndTime);
×
536
                                  created_at:
×
537
                                          ((aPull at: #created_at) ifNotNil: #asDateAndTime);
×
538
                                  sha: (aPull at: #head at: #sha);
×
539
                                  merge_commit_sha: (aPull at: #merge_commit_sha) ].
×
540
        result := self glhModel addAll: result unless: self blockOnIdEquality.
×
541
        ^ result
×
542
]
×
543

544
{ #category : #parsing }
545
GithubModelImporter >> parsePipelinesResult: pipelineOverview [
1✔
546

1✔
547
        | reader |
1✔
548
        reader := NeoJSONReader on: pipelineOverview readStream.
1✔
549
        
1✔
550
        reader for: GHAPIPipelineOverview do: [ :mapping |
1✔
551
                mapping mapInstVar: #total_count to: #total_count.
1✔
552
                (mapping mapInstVar: #workflow_runs) valueSchema: #ArrayOfPipelines ].
1✔
553
        
1✔
554
        reader
1✔
555
                for: #ArrayOfPipelines
1✔
556
                customDo: [ :customMappting |
1✔
557
                customMappting listOfElementSchema: GLHPipeline ].
1✔
558
        
1✔
559
        reader for: GLHPipeline do: [ :mapping |
1✔
560
                mapping
1✔
561
                        mapInstVar: #status to: #conclusion;
1✔
562
                        mapProperty: #run_started_at
1✔
563
                        getter: [ :object | #ignore ]
1✔
564
                        setter: [ :object :value |
1✔
565
                                object runDate: (DateAndTime fromString: value) ] ].
1✔
566
        
1✔
567
        ^ reader nextAs: GHAPIPipelineOverview
1✔
568
]
1✔
569

570
{ #category : #parsing }
571
GithubModelImporter >> parseProjectResult: aResult [
×
572

×
573
        | reader |
×
NEW
574
"        reader := NeoJSONReader on: aResult readStream.
×
575
        reader for: GLHProject do: [ :mapping |
×
576
                mapping mapInstVar: #name to: #name.
×
577
                mapping mapInstVar: #description to: #description.
×
578
                mapping mapInstVar: #id to: #id.
×
579
                mapping mapInstVar: #archived to: #archived.
×
580
                mapping mapInstVar: #web_url to: #html_url.
×
581
                mapping mapInstVar: #topics to: #topics ].
×
NEW
582
        ^ reader nextAs: GLHProject"
×
NEW
583
        
×
NEW
584
        reader := generalReader on: aResult readStream.
×
NEW
585
        
×
586
        ^ reader nextAs: GLHProject
×
587
]
×
UNCOV
588

×
UNCOV
589
{ #category : #parsing }
×
UNCOV
590
GithubModelImporter >> parseUserResult: result [
×
UNCOV
591

×
UNCOV
592
        | reader |
×
UNCOV
593
        reader := NeoJSONReader on: result readStream.
×
UNCOV
594
        reader for: GLHUser do: [ :mapping |
×
UNCOV
595
                mapping mapInstVar: #id to: #id.
×
UNCOV
596
                mapping mapInstVar: #public_email to: #email.
×
UNCOV
597
                mapping mapInstVar: #username to: #login.
×
UNCOV
598
                mapping mapInstVar: #bio to: #bio.
×
UNCOV
599
                mapping mapInstVar: #organization to: #company.
×
UNCOV
600
                mapping mapInstVar: #followers to: #followers.
×
UNCOV
601
                mapping mapInstVar: #following to: #following.
×
UNCOV
602
                mapping mapInstVar: #web_url to: #html_url.
×
UNCOV
603
                mapping mapInstVar: #name to: #name.
×
UNCOV
604
                mapping mapInstVar: #avatar_url to: #avatar_url ].
×
UNCOV
605
        ^ reader nextAs: GLHUser
×
UNCOV
606
]
×
UNCOV
607

×
UNCOV
608
{ #category : #api }
×
609
GithubModelImporter >> privateToken [
×
610
        ^ self api privateToken
×
611
]
×
UNCOV
612

×
UNCOV
613
{ #category : #api }
×
614
GithubModelImporter >> privateToken: aTokenString [
×
615
        ^ self repoApi privateToken: aTokenString
×
616
]
×
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