Skip to content

Commit ec869c7

Browse files
committed
Allow some bots through the GitHub Webhook Filter
This allows the Fast Forward bot and GitHub Actions scripts through the webhook filter. * Fast Forward bot should be allowed as otherwise any event created by this bot (i.e. it's merges to main) are not reported into Discord as it is considered a bot payload * GitHub Actions are generally things we have created ourselves and are not normally high noise, and as such are also worth reporting
1 parent 54455ff commit ec869c7

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

pydis_site/apps/api/views.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
from . import github_utils
1414

15+
WHITELISTED_GITHUB_BOTS = {
16+
"pydis-ff-bot",
17+
"github-actions"
18+
}
1519

1620
class HealthcheckView(APIView):
1721
"""
@@ -291,8 +295,16 @@ def post(self, request: Request, *, webhook_id: str, webhook_token: str) -> Resp
291295
or is_dependabot_branch_deletion
292296
or is_bot_pr_approval
293297
)
298+
299+
stripped_name = sender_name.removesuffix("[bot]")
300+
is_whitelisted_bot = stripped_name in WHITELISTED_GITHUB_BOTS
301+
294302
is_noisy_user_action = is_empty_review
295-
should_ignore = is_bot_payload or is_noisy_user_action or is_black_non_main_push
303+
should_ignore = (
304+
(is_bot_payload and not is_whitelisted_bot)
305+
or is_noisy_user_action
306+
or is_black_non_main_push
307+
)
296308

297309
if should_ignore:
298310
return Response(

0 commit comments

Comments
 (0)