@@ -23,18 +23,6 @@ async function when_suspicious({ github, context, failed_checks }){
2323
2424 // REFACTO: might wanna use a score of confidence (how suspicious it is), then react on that
2525
26- const { owner, repo } = context . repo ;
27- const issueNumber = context . payload . number ; // either issue or PR
28-
29- if ( ! configuration . label_if_suspicious ) {
30- await github . rest . issues . addLabels ( {
31- owner,
32- repo,
33- issue_number : issueNumber ,
34- labels : [ "suspicious" ]
35- } ) ;
36- }
37-
3826 const reasons = failed_checks . map ( check => `- ${ check . reason } ` ) . join ( "\n> " ) ;
3927 const commentBody = `> [!WARNING] This issue/PR has been automatically flagged as [suspicious] as it might not meet contribution requirements.
4028> Please read our contribution guide before submitting.
@@ -46,6 +34,12 @@ ${reasons}
4634
4735 console . log ( "Body of the produced comment:\n" , commentBody ) ;
4836
37+ if ( context . eventName === 'workflow_dispatch' ) // so we can test manually
38+ return ;
39+
40+ const { owner, repo } = context . repo ;
41+ const issueNumber = context . payload . number ; // either issue or PR
42+
4943 if ( configuration . comment_if_suspicious ) {
5044 await github . rest . issues . createComment ( {
5145 owner,
@@ -54,6 +48,14 @@ ${reasons}
5448 body : `${ commentBody } `
5549 } ) ;
5650 }
51+ if ( ! configuration . label_if_suspicious ) {
52+ await github . rest . issues . addLabels ( {
53+ owner,
54+ repo,
55+ issue_number : issueNumber ,
56+ labels : [ "suspicious" ]
57+ } ) ;
58+ }
5759 if ( configuration . close_if_suspicious ) {
5860 await github . rest . issues . update ( {
5961 owner,
@@ -103,6 +105,10 @@ module.exports = async ({ github, context, core }) => {
103105 return create_at >= time_point ;
104106 } ) ( ) ;
105107
108+ // ⚠️ simulate a newly-created fake account
109+ WasAuthorRecentlyCreated = true ;
110+ // ⚠️
111+
106112 const isTitleOrBodyTooShort = ( ( ) => {
107113
108114 if ( context . eventName === 'workflow_dispatch' ) // issues or pull_request
0 commit comments