Skip to content

Commit

Permalink
Revert "Slackbot: Escape special characters"
Browse files Browse the repository at this point in the history
  • Loading branch information
gordlin authored Nov 28, 2024
1 parent a62ba05 commit 2447bbf
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions .github/slack-bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,18 @@
f"<{pr_label_types[label['name']][1]}|{pr_label_types[label['name']][0]}>"
for label in pr_labels if pr_label_types.get(label['name'])
)
if len(pr_label_str) == 0:
if (len(pr_label_str) == 0):
pr_label_str = "None"

# Handle regular labels (not in pr_label_types)
reg_label_str = ", ".join(
label['name'] for label in pr_labels if pr_label_types.get(label['name']) is None
)
if len(reg_label_str) == 0:
if (len(reg_label_str) == 0):
reg_label_str = "None"

# Escape using json.dumps for JSON compatibility
escaped_summary = json.dumps(neutral_summary)[1:-1] # Removes surrounding quotes added by json.dumps
pr_label_str = json.dumps(pr_label_str)[1:-1]
reg_label_str = json.dumps(reg_label_str)[1:-1]

# Write all results to environment
# Write all results to environment
with open(os.environ['GITHUB_ENV'], 'a') as env_file:
env_file.write(f'NEUTRAL_SUMMARY="{escaped_summary}"\n')
env_file.write(f'PR_LABEL_STR="{pr_label_str}"\n')
env_file.write(f'REG_LABEL_STR="{reg_label_str}"\n')
env_file.write(f'NEUTRAL_SUMMARY={neutral_summary}\n')
env_file.write(f'PR_LABEL_STR={pr_label_str}\n')
env_file.write(f'REG_LABEL_STR={reg_label_str}\n')

0 comments on commit 2447bbf

Please sign in to comment.