Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[steps] [ENG-14373] Fix multiline slack messages with env vars #478

Conversation

radoslawkrzemien
Copy link
Contributor

Why

expo/eas-cli#2728
When setting an env var to a multiline string and then passing it as the context of a Slack message to the eas/send_slack_message function the new-line characters are not correctly handled. The implicit new-lines are removed, while explicit \n characters are used as \ and n.

How

Updated the set-env bash script to preserve the implicit new-lines when saving the var value to the file.
Added a util function that fixes the explicit escape characters when reading the raw env value from the file and updating the context.

Test Plan

Manual tests

Config

Screenshot 2024-12-11 at 13 06 43

Before

Screenshot 2024-12-11 at 13 12 02

After

Screenshot 2024-12-11 at 13 07 19

Added quotes around the env var value when saving it into the file.
The reason for it is that if you set the env value to something like "line 1
line 2
line 3"
without the quotes it would remove the implicit new-line characters and save it as 1 line

See: https://linear.app/expo/issue/ENG-14373/fix-multiline-slack-message-from-env-vars
Added an util function to replace the doubly backslashed escape character in the raw env value with actual escape characters

See: https://linear.app/expo/issue/ENG-14373/fix-multiline-slack-message-from-env-vars
Used the previously added function to fix the escape characters when reading the raw env value from the file and updating the context

See: https://linear.app/expo/issue/ENG-14373/fix-multiline-slack-message-from-env-vars
Copy link

linear bot commented Dec 11, 2024

@radoslawkrzemien radoslawkrzemien merged commit 75a9f3d into main Dec 13, 2024
5 checks passed
@radoslawkrzemien radoslawkrzemien deleted the @radoslawkrzemien/ENG-14373_fix_multiline_slack_messages_with_env_vars branch December 13, 2024 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants