diff options
author | 2024-07-18 22:29:01 +0200 | |
---|---|---|
committer | 2024-07-18 22:29:01 +0200 | |
commit | 10f3f6a591c2eb7b3e744be80edcd55f8ef469b8 (patch) | |
tree | e859e884a287952210f2abd24562c956dd6375ec /pydis_site/apps | |
parent | Timeline: Fix word breaking on hyphenation in 8th Code Jam (diff) | |
parent | Merge pull request #1365 from python-discord/more-frameworks (diff) |
Merge branch 'main' into feat/timeline-from-yaml
Diffstat (limited to 'pydis_site/apps')
-rw-r--r-- | pydis_site/apps/api/tests/test_github_utils.py | 2 | ||||
-rw-r--r-- | pydis_site/apps/api/views.py | 14 |
2 files changed, 14 insertions, 2 deletions
diff --git a/pydis_site/apps/api/tests/test_github_utils.py b/pydis_site/apps/api/tests/test_github_utils.py index d36111c9..7b41d2f6 100644 --- a/pydis_site/apps/api/tests/test_github_utils.py +++ b/pydis_site/apps/api/tests/test_github_utils.py @@ -210,7 +210,7 @@ class ArtifactFetcherTests(unittest.TestCase): def setUp(self) -> None: self.call_args = ["owner", "repo", "action_sha", "action_name", "artifact_name"] - self.client = httpx.Client(base_url="https://example.com") + self.client = httpx.Client(base_url="https://example.com", timeout=5) self.patchers = [ mock.patch.object(self.client, "send", new=self.get_response_get_artifact), 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( |