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

Revert breaking change on new line #16

Merged
merged 1 commit into from
Jun 13, 2024

Conversation

VincentLanglet
Copy link
Contributor

ℹ️ About

Hi @JoshCoady, the PR #9 introduce by @denis-trofimov was a breaking change:

I encountered this breaking change, bumping from 1.0.1 to 1.0.2 give the result:

  • from
image - to image

By escaping the \n they are not correctly interpreted by Slack anymore.

This is my github actions:

            -   name: Convert changelog's Markdown to mrkdwn
                id: changelog
                uses: LoveToKnow/[email protected]
                with:
                    text: ${{ github.event.release.body }}

            -   name: Post to a Slack channel
                id: slack
                uses: slackapi/[email protected]
                with:
                    channel-id: 'deploy'
                    payload: | 
                        {
                            "blocks": [
                        		{
                                    "type": "header",
                                    "text": {
                                        "type": "plain_text",
                                        "text": "A new version has been deployed to prod! Make the world a better place!"
                                    }
                                },
                                {
                                    "type": "section",
                                    "text": {
                                        "type": "mrkdwn",
                                        "text": ${{ toJSON(steps.changelog.outputs.text) }}
                                    }
                                }
                            ]
                        }

I agree with @hasier the right way is to Jsonify the payload, this is what we were doing.

I would say that @denis-trofimov missed this part, his PR manually escape the \n character cause he had trouble with, but the same issue could occur with some other character and not, the github actions leave us with a broken state where

  • Using toJSON break the \n
  • Not using toJson break with some other character we need to escape

I let

mrkdwn.replace(/\r\n|\r|\n/g, "\n");

to use the correct line delimiter, because I think it still can be an improvement ; but I removed the escaping.

Thanks

  • Has 🧪 tests
  • Has 📖 documentation

@JoshCoady JoshCoady merged commit f0584e4 into LoveToKnow:master Jun 13, 2024
4 checks passed
github-actions bot pushed a commit that referenced this pull request Jun 13, 2024
## [1.1.1](v1.1.0...v1.1.1) (2024-06-13)

### Bug Fixes

* Revert breaking change on new line ([#16](#16)) ([f0584e4](f0584e4))
Copy link

🎉 This PR is included in version 1.1.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants