:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(tasks): capture pr size properties on pr lifecycle events (#67768)
Andrew Maguiree38db5f8fe15
diff --git a/products/tasks/backend/tests/test_webhooks.py b/products/tasks/backend/tests/test_webhooks.pyindex e847f0a54728..d78d2e7670a6 100644--- a/products/tasks/backend/tests/test_webhooks.py+++ b/products/tasks/backend/tests/test_webhooks.py@@ -519,6 +519,10 @@ class TestExternalPRWebhook(TestCase):"title": "Internal customer change","base": {"ref": "main"},"head": {"ref": "feature/x"},+ "additions": 120,+ "deletions": 30,+ "changed_files": 5,+ "commits": 3,},}@@ -551,6 +555,10 @@ class TestExternalPRWebhook(TestCase):self.assertEqual(props["pr_number"], 7)self.assertEqual(props["pr_author"], "octocat")self.assertEqual(props["pr_base_ref"], "main")+ self.assertEqual(props["pr_additions"], 120)+ self.assertEqual(props["pr_deletions"], 30)+ self.assertEqual(props["pr_changed_files"], 5)+ self.assertEqual(props["pr_commits"], 3)self.assertIsNone(props["task_id"])self.assertIsNone(props["origin_product"])self.assertIsNone(props["title"])diff --git a/products/tasks/backend/webhooks.py b/products/tasks/backend/webhooks.pyindex 5a91b09dc285..b8edb1d1a1cd 100644--- a/products/tasks/backend/webhooks.py+++ b/products/tasks/backend/webhooks.py@@ -181,6 +181,10 @@ def _pr_payload_properties(payload: dict) -> dict:"pr_author": (pull_request.get("user") or {}).get("login"),"pr_base_ref": (pull_request.get("base") or {}).get("ref"),"pr_head_ref": (pull_request.get("head") or {}).get("ref"),+ "pr_additions": pull_request.get("additions"),+ "pr_deletions": pull_request.get("deletions"),+ "pr_changed_files": pull_request.get("changed_files"),+ "pr_commits": pull_request.get("commits"),}