Skip to content

Commit

Permalink
removed-single-quotes-from-discord-message
Browse files Browse the repository at this point in the history
  • Loading branch information
solankirishav21 committed Jul 4, 2023
1 parent 5bd8c9c commit 79c98ab
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/beamerAndDiscord.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,30 +100,27 @@ jobs:
import os
import requests
import json
github_token = os.getenv('GITHUB_TOKEN')
repo_owner = 'akto-api-security'
repo_name = 'akto'
headers = {'Authorization': f'Bearer {github_token}'}
url = f'https://api.github.com/repos/{repo_owner}/{repo_name}/releases/latest'
response = requests.get(url, headers=headers)
data = response.json()
tag = data.get('tag_name')
description = data.get('body')
# Replace anything after "by" in each line with a "."
if description:
description_lines = description.split('\n')
for i in range(len(description_lines)):
if 'by' in description_lines[i]:
description_lines[i] = description_lines[i].split('by', 1)[0].strip() + '.'
if "'" in description_lines[i]:
description_lines[i] = description_lines[i].replace("'", "''")
# Remove the last line from the description
description_lines = description_lines[:-1]
description = '\n'.join(description_lines)
description = '\n'.join(description_lines)
print(f"::set-output name=tag::{tag}")
print(f"::set-output name=description::{json.dumps(description)}")
EOF
Expand Down

0 comments on commit 79c98ab

Please sign in to comment.