@@ -153,16 +153,29 @@ module.exports = async ({ github, context, core }) => {
153
153
// for other checks
154
154
// then use a weights/factors instead of booleans,
155
155
// compute a confidence score to check against a threshold => if below, then reject
156
- const failed_checks = checks . filter ( check => ! check . pass ( ) ) ;
157
-
158
- const threshold = 0 ;
159
- if ( failed_checks . length <= threshold ) {
160
- console . info ( "Not suspicious" ) ;
161
- return ;
156
+
157
+
158
+ async function filterChecks ( checks ) {
159
+ const results = await Promise . all (
160
+ checks . map ( async ( check ) => ( {
161
+ check,
162
+ passed : await check . pass ( ) ,
163
+ } ) )
164
+ ) ;
165
+ return results . filter ( ( { passed } ) => passed ) . map ( ( { check } ) => check ) ;
162
166
}
167
+ // const failed_checks = checks.filter(check => ! check.pass());
168
+
169
+ filterChecks ( checks ) . then ( filteredChecks => {
170
+ const threshold = 0 ;
171
+ if ( failed_checks . length <= threshold ) {
172
+ console . info ( "Not suspicious" ) ;
173
+ return ;
174
+ }
163
175
164
- when_suspicious ( { github, context, failed_checks} ) ;
176
+ when_suspicious ( { github, context, failed_checks} ) ;
165
177
166
- const user_information_as_comment = collect_user_information_report ( ) ;
167
- // do stuffs with user_information_as_comment
178
+ const user_information_as_comment = collect_user_information_report ( ) ;
179
+ // do stuffs with user_information_as_comment
180
+ } ) ;
168
181
} ;
0 commit comments