mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-22 22:12:24 +01:00
Improve webhook error on create events
This commit is contained in:
parent
7aca5a54dc
commit
a800685947
@ -136,13 +136,23 @@ def webhook():
|
||||
if branch not in [ "master", "main" ]:
|
||||
return jsonify({ "success": False, "message": "Webhook ignored, as it's not on the master/main branch" })
|
||||
|
||||
elif event == "create" and json["ref_type"] == "tag":
|
||||
elif event == "create":
|
||||
ref_type = json.get("ref_type")
|
||||
if ref_type != "tag":
|
||||
return jsonify({
|
||||
"success": False,
|
||||
"message": "Webhook ignored, as it's a non-tag create event. ref_type='{}'.".format(ref_type)
|
||||
})
|
||||
|
||||
ref = json["ref"]
|
||||
title = ref
|
||||
|
||||
elif event == "ping":
|
||||
return jsonify({ "success": True, "message": "Ping successful" })
|
||||
|
||||
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."
|
||||
.format(event or "null"))
|
||||
|
||||
#
|
||||
# Perform release
|
||||
|
@ -63,7 +63,8 @@ def webhook_impl():
|
||||
ref = json["ref"]
|
||||
title = ref.replace("refs/tags/", "")
|
||||
else:
|
||||
return error(400, "Unsupported event. Only 'push' and 'tag_push' are supported.")
|
||||
return error(400, "Unsupported event: '{}'. Only 'push', 'create:tag', and 'ping' are supported."
|
||||
.format(event or "null"))
|
||||
|
||||
#
|
||||
# Perform release
|
||||
|
Loading…
Reference in New Issue
Block a user