Skip to content

Commit 617e5e7

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

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

.github/workflows/scripts/antispam.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Check {
4646
this.reason = reason;
4747
}
4848

49-
async evaluate() {
49+
async pass() {
5050
const result = await this.predicate();
5151
if (typeof result !== "boolean")
5252
console.error("Check: invalid argument: not a predicate");
@@ -90,10 +90,10 @@ module.exports = async ({ github, context, core }) => {
9090
console.log(">>> was_author_account_recently_created: ", {
9191
time_point: time_point,
9292
create_at: create_at,
93-
result: create_at <= time_point
93+
result: create_at >= time_point
9494
});
9595

96-
return create_at <= time_point;
96+
return create_at >= time_point;
9797
})();
9898

9999
console.log(">>> ", {
@@ -110,7 +110,7 @@ module.exports = async ({ github, context, core }) => {
110110
}),
111111
new Check({
112112
predicate: () => user.public_repos !== 0 && user.public_gists !== 0,
113-
reason: "Author has no public reop/gist"
113+
reason: "Author has no public repo/gist"
114114
}),
115115
new Check({
116116
predicate: () => ! WasAuthorRecentlyCreated,
@@ -123,7 +123,7 @@ module.exports = async ({ github, context, core }) => {
123123
];
124124

125125
// IDEA: use weight instead of booleans
126-
const failed_checks = checks.filter(check => check.evaluate());
126+
const failed_checks = checks.filter(check => ! check.pass());
127127

128128
const threshold = 0;
129129
console.log(">>> failed_checks amount: ", failed_checks.length, "vs. threshold: ", threshold)

0 commit comments

Comments
 (0)