aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2024-06-16 16:37:27 +0100
committerGravatar GitHub <[email protected]>2024-06-16 16:37:27 +0100
commitb1f6048fde51a0f25a34dd64aef4390c6d5b12ac (patch)
tree12084c2ac8942a17c8672a6f5f6539f3db97c988
parentBump sentry-sdk from 2.5.0 to 2.5.1 (#1340) (diff)
parentAllow some bots through the GitHub Webhook Filter (diff)
Merge pull request #1341 from python-discord/jb3/github-filter/allow-some-bots
Allow some bots through the GitHub Webhook Filter
-rw-r--r--pydis_site/apps/api/views.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/pydis_site/apps/api/views.py b/pydis_site/apps/api/views.py
index a3b0016c..05a2bb02 100644
--- a/pydis_site/apps/api/views.py
+++ b/pydis_site/apps/api/views.py
@@ -12,6 +12,10 @@ from rest_framework.views import APIView
from . import github_utils
+WHITELISTED_GITHUB_BOTS = {
+ "pydis-ff-bot",
+ "github-actions"
+}
class HealthcheckView(APIView):
"""
@@ -291,8 +295,16 @@ class GitHubWebhookFilterView(APIView):
or is_dependabot_branch_deletion
or is_bot_pr_approval
)
+
+ stripped_name = sender_name.removesuffix("[bot]")
+ is_whitelisted_bot = stripped_name in WHITELISTED_GITHUB_BOTS
+
is_noisy_user_action = is_empty_review
- should_ignore = is_bot_payload or is_noisy_user_action or is_black_non_main_push
+ should_ignore = (
+ (is_bot_payload and not is_whitelisted_bot)
+ or is_noisy_user_action
+ or is_black_non_main_push
+ )
if should_ignore:
return Response(