Skip to content

Commit 433fc27

Browse files
committed
[antispam] experimenting (WIP)
1 parent f0468e2 commit 433fc27

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

.github/workflows/scripts/antispam.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const configuration = {
22
label_if_suspicious: false,
33
comment_if_suspicious: false,
44
close_if_suspicious: false,
5+
suspicious_criteria_tolerated: 0
56
};
67

78
async function make_information_report({ user }) {
@@ -150,19 +151,26 @@ module.exports = async ({ github, context, core }) => {
150151
// then use a weights/factors instead of booleans,
151152
// compute a confidence score to check against a threshold => if below, then reject
152153

153-
async function processFailedChecks(checks) {
154+
async function failedChecks(checks) {
154155
const results = await Promise.all(
155156
checks.map(async (check) => ({
156157
check,
157158
passed: await check.pass(),
158159
}))
159160
);
160-
return results.filter(({ passed }) => passed).map(({ check }) => check);
161+
return results
162+
.filter(({ passed }) => ! passed)
163+
.map(({ check }) => check);
161164
}
162165

163-
processFailedChecks(checks).then(failed_checks => {
164-
const threshold = 0;
165-
if (failed_checks.length <= threshold) {
166+
failedChecks(checks).then(failed_checks => {
167+
168+
console.log("Checks: ", {
169+
passed: checks.length - failed_checks.length,
170+
failed: failed_checks.length
171+
})
172+
173+
if (failed_checks.length <= configuration.suspicious_criteria_tolerated) {
166174
console.info("Not suspicious");
167175
return;
168176
}

0 commit comments

Comments
 (0)