diff --git a/BuildBotLib/BuildBot.pyproject b/BuildBotLib/BuildBot.pyproject index 80f90d4..87e8ce3 100644 --- a/BuildBotLib/BuildBot.pyproject +++ b/BuildBotLib/BuildBot.pyproject @@ -23,6 +23,7 @@ "git/gitBin.sh", "qifRepogen.py", "docs.py", - "stepfactory.py" + "stepfactory.py", + "customgithubhandler.py" ] } diff --git a/BuildBotLib/buildBotChangeSource.py b/BuildBotLib/buildBotChangeSource.py index e6c2f45..ffd781b 100644 --- a/BuildBotLib/buildBotChangeSource.py +++ b/BuildBotLib/buildBotChangeSource.py @@ -2,6 +2,7 @@ from BuildBotLib.buildBotModule import BuildBotModule from BuildBotLib.secretManager import SecretManager from pathlib import Path +from BuildBotLib.customgithubhandler import CustomGitHubHandler class BuildBotChangeSource(BuildBotModule): @@ -14,5 +15,6 @@ class BuildBotChangeSource(BuildBotModule): 'github': { 'secret': secret.getValue('WebHook'), + 'class': CustomGitHubHandler }, } diff --git a/BuildBotLib/customgithubhandler.py b/BuildBotLib/customgithubhandler.py new file mode 100644 index 0000000..366a127 --- /dev/null +++ b/BuildBotLib/customgithubhandler.py @@ -0,0 +1,21 @@ +# This Python file uses the following encoding: utf-8 + +# if __name__ == "__main__": +# pass + +from buildbot.www.hooks.github import GitHubEventHandler + +class CustomGitHubHandler(GitHubEventHandler): + + def handle_push(self, payload, event): + # This field is unused: + + payload['repository']['html_url'] = payload['repository']['ssh_url'] + return super().handle_push(payload, event) + + + @defer.inlineCallbacks + def handle_pull_request(self, payload, event): + + payload['repository']['html_url'] = payload['repository']['ssh_url'] + return super().handle_pull_request(payload, event)