1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Don't crash if a non-master and non-unity branch is pushed to

This commit is contained in:
Steffo 2019-03-24 12:00:50 +01:00
parent 36fb339480
commit 0b7219f27a

View file

@ -394,15 +394,18 @@ def hooks_github():
# TODO: add secret check # TODO: add secret check
if j["ref"] == "refs/heads/master": if j["ref"] == "refs/heads/master":
message = f"🐙 Nuovi aggiornamenti a Royalnet <code>master</code>:\n" message = f"🐙 Nuovi aggiornamenti a Royalnet <code>master</code>:\n"
if j["ref"] == "refs/heads/unity": elif j["ref"] == "refs/heads/unity":
message = f"🐙 Progresso di Royalnet <code>unity</code>:\n" message = f"🐙 Progresso di Royalnet <code>unity</code>:\n"
for commit in j.get("commits", []): else:
if commit["distinct"]: return "Ignored."
message += f'<a href="{commit["url"]}">{commit["message"]}</a>' \ if message:
f' di <b>{commit["author"].get("username", "anonimo")}</b>\n' for commit in j.get("commits", []):
telegram_bot.send_message(config["Telegram"]["main_group"], message, if commit["distinct"]:
parse_mode="HTML", disable_web_page_preview=True, disable_notification=True) message += f'<a href="{commit["url"]}">{commit["message"]}</a>' \
return "Done." f' di <b>{commit["author"].get("username", "anonimo")}</b>\n'
telegram_bot.send_message(config["Telegram"]["main_group"], message,
parse_mode="HTML", disable_web_page_preview=True, disable_notification=True)
return "Done."
@app.before_request @app.before_request