1
0
Fork 0
mirror of https://github.com/zigzap/zap.git synced 2025-10-21 07:34:08 +00:00

github workflow permissions

This commit is contained in:
Rene Schallner 2023-05-22 03:04:47 +02:00
parent 01ce845d76
commit 94010505e9
3 changed files with 10 additions and 5 deletions

View file

@ -1,5 +1,8 @@
name: Create Release, update README, send announceybot name: Create Release, update README, send announceybot
# we need write permission on contents for the release action
permissions: read-all|write-all
on: on:
push: push:
tags: tags:

View file

@ -9,7 +9,7 @@ TAG_NAME = os.getenv("TAG_NAME", sys.argv[1])
def send_to_discord(message): def send_to_discord(message):
webhook = DiscordWebhook(url=URL, rate_limit_retry=True, content=message) webhook = DiscordWebhook(url=URL, rate_limit_retry=True, content=message)
if os.getenv("DEBUG", None) == None: if os.getenv("DEBUG", None) is None:
return webhook.execute() return webhook.execute()
else: else:
print("Sending ...") print("Sending ...")
@ -19,12 +19,13 @@ def send_to_discord(message):
def get_tag_annotation(tagname): def get_tag_annotation(tagname):
ret = subprocess.run([ ret = subprocess.run([
"git", "git",
"tag",
"-l", "-l",
"--format='%(contents)'", "--format='%(contents)'",
f"{TAG_NAME}", f"{TAG_NAME}",
], capture_output=True) ], capture_output=True)
text = ret.stdout.decode("utf-8") text = ret.stdout.decode("utf-8")
return text return text.replace("'", "").replace('"', '\\"')
def get_replacement(): def get_replacement():
@ -39,10 +40,10 @@ def get_replacement():
if __name__ == '__main__': if __name__ == '__main__':
annotation = get_tag_annotation(TAG_NAME) annotation = get_tag_annotation(TAG_NAME)
zon_update = get_replacement() zon_update = get_replacement().replace('"', '\\"')
message = f'''# TEST-RUN TEST-RUN TEST-RUN message = f'''# TEST-RUN TEST-RUN TEST-RUN
# New release {TAG_NAME}! # New release {TAG_NAME}!
## Updates ## Updates

View file

@ -8,12 +8,13 @@ TAG_NAME = os.getenv("TAG_NAME", sys.argv[1])
def get_tag_annotation(tagname): def get_tag_annotation(tagname):
ret = subprocess.run([ ret = subprocess.run([
"git", "git",
"tag",
"-l", "-l",
"--format='%(contents)'", "--format='%(contents)'",
f"{TAG_NAME}", f"{TAG_NAME}",
], capture_output=True) ], capture_output=True)
text = ret.stdout.decode("utf-8") text = ret.stdout.decode("utf-8")
return text return text.replace("'", "")
def get_replacement(): def get_replacement():