Initial commit

This commit is contained in:
Agate 2022-11-02 10:33:33 +01:00 committed by Gitea
parent a33f3a16d8
commit e8ef4d3214
4 changed files with 59 additions and 0 deletions

19
gitea_redmine/__init__.py Normal file
View File

@ -0,0 +1,19 @@
import os
import json
import requests
import flask
INCOMING_WEBHOOK_SECRET = os.environ["INCOMING_WEBHOOK_SECRET"]
REDMINE_URL = os.environ["REDMINE_URL"]
REDMINE_API_KEY = os.environ["REDMINE_API_KEY"]
from flask import Flask
app = Flask(__name__)
@app.route("/incoming-webhook/<token>", methods=['POST'])
def incoming_webhook(token):
if token != INCOMING_WEBHOOK_SECRET:
return {'status': 'error', 'detail': 'Invalid token'}, 403
return {'status': 'success'}

27
setup.py Normal file
View File

@ -0,0 +1,27 @@
#! /usr/bin/env python
from setuptools import find_packages, setup
setup(
name='gitea-redmine',
version="0.1",
description='Micro serveur HTTP pour intercepter les webhooks Gitea et mettre à jour les tickets redmine correspondants avec les bons status / liens vers pull requests.',
author='Agate Berriot',
author_email='aberriot@entrouvert.com',
packages=find_packages(exclude=['tests']),
include_package_data=True,
url='https://gitea.entrouvert.org/entrouvert/gitea-redmine',
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Web Environment',
'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
],
install_requires=[
'python-redmine',
'flask'
],
zip_safe=False,
)

0
tests/test_app.py Normal file
View File

13
tox.ini Normal file
View File

@ -0,0 +1,13 @@
[tox]
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/gitea-redmine/{env:BRANCH_NAME:}
envlist = py3
[testenv]
usedevelop = True
setenv =
TOX_WORK_DIR={toxworkdir}
deps =
requests
flask
commands =
pytest