mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-23 06:22: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" ]:
|
if branch not in [ "master", "main" ]:
|
||||||
return jsonify({ "success": False, "message": "Webhook ignored, as it's not on the master/main branch" })
|
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"]
|
ref = json["ref"]
|
||||||
title = ref
|
title = ref
|
||||||
|
|
||||||
elif event == "ping":
|
elif event == "ping":
|
||||||
return jsonify({ "success": True, "message": "Ping successful" })
|
return jsonify({ "success": True, "message": "Ping successful" })
|
||||||
|
|
||||||
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."
|
||||||
|
.format(event or "null"))
|
||||||
|
|
||||||
#
|
#
|
||||||
# Perform release
|
# Perform release
|
||||||
|
@ -63,7 +63,8 @@ def webhook_impl():
|
|||||||
ref = json["ref"]
|
ref = json["ref"]
|
||||||
title = ref.replace("refs/tags/", "")
|
title = ref.replace("refs/tags/", "")
|
||||||
else:
|
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
|
# Perform release
|
||||||
|
Loading…
Reference in New Issue
Block a user