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

moosetechnology / GitProjectHealth / 15685699682

16 Jun 2025 03:55PM UTC coverage: 74.453% (+1.2%) from 73.222%
15685699682

push

github

web-flow
Merge pull request #202 from moosetechnology/develop

Update Main

1293 of 2646 new or added lines in 26 files covered. (48.87%)

62 existing lines in 3 files now uncovered.

17142 of 23024 relevant lines covered (74.45%)

0.74 hits per line

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

20.87
/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 : #commit }
NEW
32
GithubModelImporter >> completeImportedCommit: aGLHCommit [
×
NEW
33

×
NEW
34
        | result |
×
NEW
35
        ('completing commit: ' , aGLHCommit short_id printString) recordInfo.
×
NEW
36
        "link commit to user"
×
NEW
37
        self importCreatorOfCommit: aGLHCommit.
×
NEW
38

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

×
NEW
49

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

×
NEW
61
        ^ aGLHCommit 
×
NEW
62
]
×
63

64
{ #category : #api }
NEW
65
GithubModelImporter >> completeImportedProject: aGLHProject [
×
NEW
66

×
NEW
67
        self importPipelinesOf: aGLHProject.
×
NEW
68
        self importBranchesOf: aGLHProject.
×
NEW
69
        self withCommitsSince ifNotNil: [ :withCommitSince | "If not nil, it means we have to import commit"
×
NEW
70
                | commits |
×
NEW
71
                commits := self importCommitsOfProject: aGLHProject.
×
NEW
72
                self chainsCommitsFrom: commits ]
×
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

×
NEW
162
        | creator |
×
NEW
163
        (self glhModel allWithType: GLHUser)
×
NEW
164
                detect: [ :user | user username = aGLHCommit author_name ]
×
NEW
165
                ifFound: [ :user |
×
NEW
166
                        aGLHCommit commitCreator: user.
×
NEW
167
                        ^ user ].
×
NEW
168

×
NEW
169
        aGLHCommit author_name ifNotNil: [ :author_name |
×
NEW
170
                creator := self importUserByUsername: author_name.
×
NEW
171
                aGLHCommit commitCreator: creator ].
×
NEW
172
        ^ creator
×
NEW
173
]
×
174

175
{ #category : #api }
NEW
176
GithubModelImporter >> importDiffOfCommit: aGLHCommit [
×
NEW
177

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

×
NEW
191
        ^ aGLHCommit diffs
×
NEW
192
                  addAll: diffsResult
×
NEW
193
                  unless: self blockForDiffEquality
×
NEW
194
]
×
195

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

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

218
{ #category : #api }
NEW
219
GithubModelImporter >> importFilesOfBranch: aBranch [
×
NEW
220

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

239
{ #category : #api }
NEW
240
GithubModelImporter >> importGroup: aGroupName [
×
NEW
241

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

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

263
{ #category : #api }
NEW
264
GithubModelImporter >> importPipelinesOf: project [
×
NEW
265

×
NEW
266
        "add the pipeline (actions runs) in the project"
×
NEW
267

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

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

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

290
{ #category : #api }
NEW
291
GithubModelImporter >> importRepositoriesOfGroup: groupResult [
×
NEW
292

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

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

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

324
{ #category : #api }
NEW
325
GithubModelImporter >> importUser: userID [
×
NEW
326

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

339
{ #category : #initialization }
340
GithubModelImporter >> initialize [
1✔
341

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

348
{ #category : #parsing }
NEW
349
GithubModelImporter >> parseArrayOfProject: arrayOfProjects [
×
NEW
350

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

367
{ #category : #parsing }
NEW
368
GithubModelImporter >> parseBranchesResult: arrayOfBranch [
×
NEW
369

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

380
{ #category : #parsing }
381
GithubModelImporter >> parseCommitsResult: result [
1✔
382

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

1✔
387
        reader := NeoJSONReader on: result readStream.
1✔
388

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

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

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

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

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

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

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

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

1✔
435

1✔
436
        ^ reader nextAs: #ArrayOfCommit
1✔
437
]
1✔
438

439
{ #category : #parsing }
NEW
440
GithubModelImporter >> parseDiffresult: response [
×
NEW
441

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

×
NEW
449
        ^ result
×
NEW
450
]
×
451

452
{ #category : #parsing }
NEW
453
GithubModelImporter >> parseFileTreeResult: aResult [
×
NEW
454

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

465
{ #category : #parsing }
NEW
466
GithubModelImporter >> parseGroupResult: aResult [
×
NEW
467

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

478
{ #category : #parsing }
NEW
479
GithubModelImporter >> parseMergeRequestsResult: response [
×
NEW
480

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

502
{ #category : #parsing }
503
GithubModelImporter >> parsePipelinesResult: pipelineOverview [
1✔
504

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

528
{ #category : #parsing }
NEW
529
GithubModelImporter >> parseProjectResult: aResult [
×
NEW
530

×
NEW
531
        | reader |
×
NEW
532
        reader := NeoJSONReader on: aResult readStream.
×
NEW
533
        reader for: GLHProject do: [ :mapping |
×
NEW
534
                mapping mapInstVar: #name to: #name.
×
NEW
535
                mapping mapInstVar: #description to: #description.
×
NEW
536
                mapping mapInstVar: #id to: #id.
×
NEW
537
                mapping mapInstVar: #archived to: #archived.
×
NEW
538
                mapping mapInstVar: #web_url to: #html_url.
×
NEW
539
                mapping mapInstVar: #topics to: #topics ].
×
NEW
540
        ^ reader nextAs: GLHProject
×
NEW
541
]
×
542

543
{ #category : #parsing }
544
GithubModelImporter >> parseUserResult: result [
1✔
545

1✔
546
        | reader |
1✔
547
        reader := NeoJSONReader on: result readStream.
1✔
548
        reader for: GLHUser do: [ :mapping |
1✔
549
                mapping mapInstVar: #id to: #id.
1✔
550
                mapping mapInstVar: #public_email to: #email.
1✔
551
                mapping mapInstVar: #username to: #login.
1✔
552
                mapping mapInstVar: #bio to: #bio.
1✔
553
                mapping mapInstVar: #organization to: #company.
1✔
554
                mapping mapInstVar: #followers to: #followers.
1✔
555
                mapping mapInstVar: #following to: #following.
1✔
556
                mapping mapInstVar: #web_url to: #html_url.
1✔
557
                mapping mapInstVar: #name to: #name.
1✔
558
                mapping mapInstVar: #avatar_url to: #avatar_url ].
1✔
559
        ^ reader nextAs: GLHUser
1✔
560
]
1✔
561

562
{ #category : #api }
NEW
563
GithubModelImporter >> privateToken [
×
NEW
564
        ^ self api privateToken
×
NEW
565
]
×
566

567
{ #category : #api }
NEW
568
GithubModelImporter >> privateToken: aTokenString [
×
NEW
569
        ^ self repoApi privateToken: aTokenString
×
NEW
570
]
×
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