Skip to content

Commit a7c58ad

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

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

.github/workflows/scripts/antispam.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ module.exports = async ({ github, context, core }) => {
6262

6363
const { data: user } = await github.rest.users.getByUsername({ username: author });
6464

65-
const isAuthorOnlyContributionOnGH = async () => {
65+
const isAuthorOnlyContributionOnGH = await (async () => {
6666
// WARNING: Depending on the time of day, event latency can be anywhere from 30s to 6h. (source: https://octokit.github.io/rest.js/v21/)
6767
const { data: events } = await github.rest.activity.listEventsForAuthenticatedUser({
6868
username: author,
@@ -76,8 +76,8 @@ module.exports = async ({ github, context, core }) => {
7676
});
7777

7878
return events.length === 0;
79-
};
80-
const WasAuthorRecentlyCreated = () => {
79+
})();
80+
const WasAuthorRecentlyCreated = (() => {
8181

8282
const time_point = (() => {
8383
let value = new Date();
@@ -92,7 +92,7 @@ module.exports = async ({ github, context, core }) => {
9292
});
9393

9494
return create_at <= time_point;
95-
}
95+
})();
9696

9797
const checks = [
9898
new Check({
@@ -104,11 +104,11 @@ module.exports = async ({ github, context, core }) => {
104104
reason: "Author has no public reop/gist"
105105
}),
106106
new Check({
107-
predicate: WasAuthorRecentlyCreated(),
107+
predicate: () => WasAuthorRecentlyCreated,
108108
reason: "Account is less than an hour old"
109109
}),
110110
new Check({
111-
predicate: await isAuthorOnlyContributionOnGH(),
111+
predicate: () => isAuthorOnlyContributionOnGH,
112112
reason: "First contribution to any GitHub project"
113113
}),
114114
];

0 commit comments

Comments
 (0)