Update webhook and setup

This commit is contained in:
shekhar-cis 2023-01-02 20:30:09 +05:30
parent 5885c8cbbe
commit 97485eb48d
Signed by: shekhar-cis
GPG Key ID: F4F00AB04E83F9A7
2 changed files with 12 additions and 22 deletions

View File

@ -34,7 +34,7 @@ class TransifexHandler(BaseHookHandler):
repository = payload['repository'] repository = payload['repository']
repo_url = repository['ssh_url'] repo_url = repository['ssh_url']
project = repository['full_name'] project = repository['buildbot-transifex']
commits = payload['commits'] commits = payload['commits']
if isinstance(self.options, dict) and self.options.get('onlyIncludePushCommit', False): if isinstance(self.options, dict) and self.options.get('onlyIncludePushCommit', False):
@ -74,14 +74,14 @@ class TransifexHandler(BaseHookHandler):
# Only handle potential new stuff, ignore close/. # Only handle potential new stuff, ignore close/.
# Merge itself is handled by the regular branch push message # Merge itself is handled by the regular branch push message
if action not in ['opened', 'synchronized', 'edited', 'reopened']: if action not in ['opened', 'synchronized', 'edited', 'reopened']:
log.msg("Gitea Pull Request event '{}' ignored".format(action)) log.msg("Transifex Pull Request event '{}' ignored".format(action))
return [] return []
pull_request = payload['pull_request'] pull_request = payload['pull_request']
if not pull_request['mergeable']: if not pull_request['mergeable']:
log.msg("Gitea Pull Request ignored because it is not mergeable.") log.msg("Transifex Pull Request ignored because it is not mergeable.")
return [] return []
if pull_request['merged']: if pull_request['merged']:
log.msg("Gitea Pull Request ignored because it is already merged.") log.msg("Transifex Pull Request ignored because it is already merged.")
return [] return []
timestamp = dateparse(pull_request['updated_at']) timestamp = dateparse(pull_request['updated_at'])
base = pull_request['base'] base = pull_request['base']
@ -189,5 +189,4 @@ class TransifexHandler(BaseHookHandler):
return (changes, 'transifex') return (changes, 'transifex')
# Plugin name
transifex = TransifexHandler transifex = TransifexHandler

View File

@ -8,30 +8,21 @@ with open("README.md", "r") as fh:
VERSION = "1.7.2" VERSION = "1.7.2"
setup(name='buildbot-gitea', setup(name='buildbot-transifex',
version=VERSION, version=VERSION,
description='buildbot plugin for integration with Gitea.', description='buildbot plugin for integration with transifex.',
author='Marvin Pohl', author='',
author_email='hello@lab132.com', author_email='',
url='https://github.com/lab132/buildbot-gitea', url='',
long_description=long_description, long_description='Transifex webhook',
long_description_content_type="text/markdown", long_description_content_type="text/markdown",
packages=['buildbot_gitea'], packages=['buildbot_transifex'],
install_requires=[ install_requires=[
"buildbot>=3.0.0" "buildbot>=3.0.0"
], ],
entry_points={ entry_points={
"buildbot.webhooks": [ "buildbot.webhooks": [
"gitea = buildbot_gitea.webhook:gitea" "transifex = buildbot_transifex.webhook:transifex"
],
"buildbot.steps": [
"Gitea = buildbot_gitea.step_source:Gitea"
],
"buildbot.reporters": [
"GiteaStatusPush = buildbot_gitea.reporter:GiteaStatusPush"
],
"buildbot.util": [
"GiteaAuth = buildbot_gitea.auth:GiteaAuth"
] ]
}, },
classifiers=[ classifiers=[