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

New line does not work #473

Open
yaroslav-storozhik opened this issue Jan 31, 2025 · 2 comments
Open

New line does not work #473

yaroslav-storozhik opened this issue Jan 31, 2025 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@yaroslav-storozhik
Copy link

Orb version: 5.1.1

        - run:
          name: Get changelog
          command: |
            echo "circle test" > releasenotes.txt
            echo "circle test 2" >> releasenotes.txt
            echo "circle test 3" >> releasenotes.txt

            rnotes="$(cat releasenotes.txt | awk '{printf "%s\\n", $0}')"
            echo "export M_CHANGELOG='$rnotes'" >> $BASH_ENV
      - slack/notify:
          event: pass
          channel: "#builds-android"
          custom: |
            {
              "blocks": [ 
                {
                  "type": "section",
                  "text": {
                    "type": "mrkdwn",
                    "text": "$M_CHANGELOG"
                  }
                }
              ]
            }

actual result message in slack writen as

circle test\ncircle test 2\ncircle test 3\n

expected result message in stack writen as

circle test
circle test 2
circle test 3
@yaroslav-storozhik yaroslav-storozhik added the bug Something isn't working label Jan 31, 2025
@yaroslav-storozhik
Copy link
Author

found an issue. Orb (or slack API inside) ignores new line if string is not formated as UTF8. It seams releasenotes.txt is created at UTF16 formated. When i change its encoding to UTF 8 than it works well

      - run:
          name: Get changelog
          command: |
            RELEASE_NOTES=$(cat releasenotes.txt)
            echo "export M_CHANGELOG='$RELEASE_NOTES'" >> "$BASH_ENV"

      - slack/notify:
          event: pass
          channel: $SLACK_DEFAULT_CHANEL
          custom: |
            {
              "blocks": [
                {

                {
                  "type": "section",
                  "text": {
                    "type": "mrkdwn",
                    "text": "$M_CHANGELOG"
                  }
                }
              ]
            }

@marboledacci marboledacci self-assigned this Feb 13, 2025
@marboledacci
Copy link
Contributor

Slack doesn't take the environment variables, that's done by the orb. This is interesting though, because the orb basically creates a new string with the expanded values, so the original encoding shouldn't be problematic. I'll be taking a look at this, and try to improve the behavior, but as there is many other ways to have the desired result, is not the highest priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants