Please sign in to comment.
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 Sample of the parsed payload for clarification : Push : added change with revision ce9e9d44b2d090541099f540e706c8ae54b89a05 to database injected change Change(revision=u'ce9e9d44b2d090541099f540e706c8ae54b89a05', who=u'Anish Bhatt <email@example.com>', branch=u'master', comments=u'Create TEST', when=1457647806, category=None, project=u'knightswhosaynee/testrepo', repository=u'https://github.com/knightswhosaynee/testrepo', codebase=u'') Pull : added change with revision db35deb31691cd50617342718125ed1aa61303e3 to database injected change Change(revision=u'db35deb31691cd50617342718125ed1aa61303e3', who=u'anish-bhatt', branch=u'refs/pull/3/head', comments=u'GitHub Pull Request #3 (1 commit)', when=1457647899, category=u'pull', project=u'', repository=u'https://github.com/knightswhosaynee/testrepo.git', codebase=u'') Note how the repository field doesn't match up due to suffix and empty project field in the pull request.
- Loading branch information...
Showing with 13 additions and 3 deletions.