@@ -64,45 +64,50 @@ export async function GET(request, { params }) {
64
64
65
65
// perform checks on these repositories
66
66
// use the owners github token (repository->user->account.access_token)
67
- let runs = [ ] ;
67
+ let runs = { attempted : [ ] , sucessful : [ ] } ;
68
68
repoStatus . run . map ( async ( repo ) => {
69
- const responses = await getAllRepoData ( repo . url , repo . token ) ;
69
+ try {
70
+ const responses = await getAllRepoData ( repo . url , repo . token ) ;
70
71
71
- // save github api data
72
- const githubResponseRepo = await prisma . githubResponse . create ( {
73
- data : {
74
- repository : {
75
- connect : {
76
- id : repo . id ,
72
+ // save github api data
73
+ const githubResponseRepo = await prisma . githubResponse . create ( {
74
+ data : {
75
+ repository : {
76
+ connect : {
77
+ id : repo . id ,
78
+ } ,
77
79
} ,
80
+ ...responses ,
78
81
} ,
79
- ...responses ,
80
- } ,
81
- } ) ;
82
+ } ) ;
82
83
83
- // perform check
84
- const results = checks ( githubResponseRepo ) ;
84
+ // perform check
85
+ const results = checks ( githubResponseRepo ) ;
85
86
86
- // save results
87
- await prisma . check . create ( {
88
- data : {
89
- repository : {
90
- connect : { id : repo . id } ,
91
- } ,
92
- githubResponse : {
93
- connect : { id : githubResponseRepo . id } ,
87
+ // save results
88
+ await prisma . check . create ( {
89
+ data : {
90
+ repository : {
91
+ connect : { id : repo . id } ,
92
+ } ,
93
+ githubResponse : {
94
+ connect : { id : githubResponseRepo . id } ,
95
+ } ,
96
+ red : results . summary . error ?. length || 0 ,
97
+ amber : results . summary . warning ?. length || 0 ,
98
+ green : results . summary . success ?. length || 0 ,
99
+ healthchecks : results . checks . map ( ( check ) => check . id ) ,
100
+ data : results . checks ,
101
+ allData : results . allChecks ,
102
+ ignoreChecks : results . ignoreChecks ,
94
103
} ,
95
- red : results . summary . error ?. length || 0 ,
96
- amber : results . summary . warning ?. length || 0 ,
97
- green : results . summary . success ?. length || 0 ,
98
- healthchecks : results . checks . map ( ( check ) => check . id ) ,
99
- data : results . checks ,
100
- allData : results . allChecks ,
101
- ignoreChecks : results . ignoreChecks ,
102
- } ,
103
- } ) ;
104
+ } ) ;
104
105
105
- runs . push ( { url : repo . url } ) ;
106
+ runs . sucessful . push ( { url : repo . url } ) ;
107
+ } catch ( e ) {
108
+ console . error ( e ) ;
109
+ runs . attempted . push ( { url : repo . url } ) ;
110
+ }
106
111
} ) ;
107
112
108
113
console . log ( "CHECKS PERFORMED" , runs ) ;
0 commit comments