Skip to content

Commit f009301

Browse files
committed
[antispam] experimenting (WIP)
1 parent a7c58ad commit f009301

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

.github/workflows/scripts/antispam.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ module.exports = async ({ github, context, core }) => {
7171

7272
console.log(">>> is_author_only_contribution_on_GH: ", {
7373
username: author,
74-
events_length: events.length === 0,
75-
events: events
74+
events: events,
75+
events_length: events.length,
76+
result: events.length === 0,
7677
});
7778

7879
return events.length === 0;
@@ -83,32 +84,40 @@ module.exports = async ({ github, context, core }) => {
8384
let value = new Date();
8485
value.setHours(value.getHours() - 2);
8586
return value;
86-
});
87+
})();
8788
const create_at = new Date(user.created_at);
8889

8990
console.log(">>> was_author_account_recently_created: ", {
9091
time_point: time_point,
91-
create_at: create_at
92+
create_at: create_at,
93+
result: create_at <= time_point
9294
});
9395

9496
return create_at <= time_point;
9597
})();
9698

99+
console.log(">>> ", {
100+
followers: user.followers,
101+
following: user.following,
102+
public_repos: user.public_repos,
103+
public_gists: user.public_gists
104+
})
105+
97106
const checks = [
98107
new Check({
99-
predicate: () => user.followers === 0 && user.following === 0,
108+
predicate: () => user.followers !== 0 && user.following !== 0,
100109
reason: "Author has no relationships"
101110
}),
102111
new Check({
103-
predicate: () => user.public_repos === 0 && user.public_gists === 0,
112+
predicate: () => user.public_repos !== 0 && user.public_gists !== 0,
104113
reason: "Author has no public reop/gist"
105114
}),
106115
new Check({
107-
predicate: () => WasAuthorRecentlyCreated,
116+
predicate: () => ! WasAuthorRecentlyCreated,
108117
reason: "Account is less than an hour old"
109118
}),
110119
new Check({
111-
predicate: () => isAuthorOnlyContributionOnGH,
120+
predicate: () => ! isAuthorOnlyContributionOnGH,
112121
reason: "First contribution to any GitHub project"
113122
}),
114123
];

0 commit comments

Comments
 (0)