Disable updateconfig if webhooks are used
This commit is contained in:
parent
693cf4250a
commit
a02942b7e0
|
@ -145,6 +145,9 @@ def webhook():
|
||||||
else:
|
else:
|
||||||
return error(400, "Unsupported event. Only 'push', `create:tag`, and 'ping' are supported.")
|
return error(400, "Unsupported event. Only 'push', `create:tag`, and 'ping' are supported.")
|
||||||
|
|
||||||
|
# Disable update config if webhooks are used
|
||||||
|
package.update_config = None
|
||||||
|
|
||||||
#
|
#
|
||||||
# Perform release
|
# Perform release
|
||||||
#
|
#
|
||||||
|
@ -217,7 +220,7 @@ def setup_webhook():
|
||||||
form=form, package=package)
|
form=form, package=package)
|
||||||
|
|
||||||
|
|
||||||
def handleMakeWebhook(gh_user, gh_repo, package, oauth, event, token):
|
def handleMakeWebhook(gh_user: str, gh_repo: str, package: Package, oauth: str, event: str, token: APIToken):
|
||||||
url = "https://api.github.com/repos/{}/{}/hooks".format(gh_user, gh_repo)
|
url = "https://api.github.com/repos/{}/{}/hooks".format(gh_user, gh_repo)
|
||||||
headers = {
|
headers = {
|
||||||
"Authorization": "token " + oauth
|
"Authorization": "token " + oauth
|
||||||
|
@ -258,6 +261,7 @@ def handleMakeWebhook(gh_user, gh_repo, package, oauth, event, token):
|
||||||
r = requests.post(url, headers=headers, data=json.dumps(data))
|
r = requests.post(url, headers=headers, data=json.dumps(data))
|
||||||
|
|
||||||
if r.status_code == 201:
|
if r.status_code == 201:
|
||||||
|
package.update_config = None
|
||||||
db.session.add(token)
|
db.session.add(token)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue