Make github payload parsing for pull requests more consistent Currently, for a push request the repository field is filled with the value of ['repository']['url'] but a pull request uses ['repository']['clone_url']. The clone_url has a .git suffix, this results in a non-regex filter for a git url working with only the push or the pull request, not both. This schema is only followed on github enterprise, whereas github.com uses a different domain for pull requests (api.github.com). ['repository']['html_url'] is preferred instead as it follows the same format on github & GHE and hence matches everywhere Fix and also parse and fill repository field for pull requests, update documentation https://github.com/buildbot/buildbot/commit/3703f2f77ea3ce5b9070770ec383bf004bea6867 This is necessary now that the url field reported in webhooks has changed. https://github.blog/changelog/2025-04-07-changes-to-the-repository-object-in-push-webhook/ --- buildbot/status/web/hooks/github.py.orig 2016-07-15 06:42:03.000000000 -0500 +++ buildbot/status/web/hooks/github.py 2025-04-10 15:42:28.000000000 -0500 @@ -101,7 +101,7 @@ user = None # user = payload['pusher']['name'] repo = payload['repository']['name'] - repo_url = payload['repository']['url'] + repo_url = payload['repository']['html_url'] # NOTE: what would be a reasonable value for project? # project = request.args.get('project', [''])[0] project = payload['repository']['full_name'] @@ -130,7 +130,8 @@ 'when_timestamp': dateparse(payload['pull_request']['created_at']), 'branch': refname, 'revlink': payload['pull_request']['_links']['html']['href'], - 'repository': payload['repository']['clone_url'], + 'repository': payload['repository']['html_url'], + 'project': payload['pull_request']['base']['repo']['full_name'], 'category': 'pull', # TODO: Get author name based on login id using txgithub module 'author': payload['sender']['login'], --- buildbot/test/unit/test_status_web_hooks_github.py.orig 2016-07-15 06:42:03.000000000 -0500 +++ buildbot/test/unit/test_status_web_hooks_github.py 2025-04-10 15:42:09.000000000 -0500 @@ -38,6 +38,7 @@ "before": "5aef35982fb2d34e9d9d4502f6ede1072793222d", "repository": { "url": "http://github.com/defunkt/github", + "html_url": "http://github.com/defunkt/github", "name": "github", "full_name": "defunkt/github", "description": "You're lookin' at it.", @@ -85,6 +86,7 @@ "before": "5aef35982fb2d34e9d9d4502f6ede1072793222d", "repository": { "url": "http://github.com/defunkt/github", + "html_url": "http://github.com/defunkt/github", "name": "github", "full_name": "defunkt/github", "description": "You're lookin' at it.", @@ -245,6 +247,7 @@ "before": "5aef35982fb2d34e9d9d4502f6ede1072793222d", "repository": { "url": "http://github.com/defunkt/github", + "html_url": "http://github.com/defunkt/github", "name": "github", "full_name": "defunkt/github", "description": "You're lookin' at it.", @@ -477,7 +480,7 @@ self.assertEquals(len(self.request.addedChanges), 1) change = self.request.addedChanges[0] self.assertEquals(change["repository"], - "https://github.com/defunkt/github.git") + "https://github.com/defunkt/github") self.assertEquals(timegm(change["when_timestamp"].utctimetuple()), 1412899790) self.assertEquals(change["author"], --- docs/manual/cfg-statustargets.rst.orig 2016-08-08 10:33:20.000000000 -0500 +++ docs/manual/cfg-statustargets.rst 2025-04-10 15:43:24.000000000 -0500 @@ -683,6 +683,11 @@ Note that not using ``change_hook_auth`` may expose you to security risks. +.. note:: + + When using a :ref:`ChangeFilter` with a GitHub webhook ensure that your filter matches all desired requests as fields such as ``repository`` and ``project`` may differ in different events. + + BitBucket hook ##############