@@ -21,14 +21,14 @@ async function when_suspicious({ github, context, failed_checks }){
21
21
22
22
const reasons = failed_checks . map ( check => `- ${ check . reason } ` ) . join ( "\n" ) ;
23
23
const commentBody = `This issue/PR has been automatically flagged as [suspicious] as it might not meet contribution requirements.
24
- Please read our contribution guide before submitting.
25
-
26
- Reason(s):
24
+ Please read our contribution guide before submitting.
25
+
26
+ Reason(s):
27
27
28
- ${ reasons }
28
+ ${ reasons }
29
29
` ;
30
30
31
- console . log ( ">>> DEBUG" , commentBody ) ;
31
+ console . log ( ">>> DEBUG:\n " , commentBody ) ;
32
32
33
33
// await github.rest.issues.createComment({
34
34
// owner,
@@ -66,7 +66,6 @@ module.exports = async ({ github, context, core }) => {
66
66
67
67
const { data : user } = await github . rest . users . getByUsername ( { username : author } ) ;
68
68
69
-
70
69
const was_author_account_recently_created = ( ( ) => {
71
70
72
71
const time_point = ( ( ) => {
@@ -81,7 +80,7 @@ module.exports = async ({ github, context, core }) => {
81
80
create_at : create_at
82
81
} ) ;
83
82
84
- return create_at > = time_point ;
83
+ return create_at < = time_point ;
85
84
} ) ( ) ;
86
85
87
86
const is_author_only_contribution_on_GH = ( async ( ) => {
@@ -98,14 +97,16 @@ module.exports = async ({ github, context, core }) => {
98
97
return events . length === 0 ;
99
98
} ) ( ) ;
100
99
100
+ console . log ( ">>> context.payload:" , context . payload )
101
+
101
102
const checks = [
102
- new Check ( ( ) => was_author_account_recently_created , "Account is less than an hour old" ) ,
103
- new Check ( ( ) => is_author_only_contribution_on_GH , "First contribution to any GitHub project" ) ,
103
+ new Check ( ( ) => was_author_account_recently_created ( ) , "Account is less than an hour old" ) ,
104
+ new Check ( ( ) => is_author_only_contribution_on_GH ( ) , "First contribution to any GitHub project" ) ,
104
105
new Check ( ( ) => user . followers === 0 && user . following === 0 , "Author has no relationships" ) ,
105
106
new Check ( ( ) => user . public_repos === 0 && user . public_gists === 0 , "Author has no public reop/gist" ) ,
106
107
] ;
107
108
108
- const failed_checks = checks . filter ( check => ! check . evaluate ( ) ) ;
109
+ const failed_checks = checks . filter ( check => check . evaluate ( ) ) ;
109
110
110
111
const threshold = 0 ;
111
112
console . log ( ">>> failed_checks amount: " , failed_checks . length , "vs. threshold: " , threshold )
0 commit comments