asyncapi / .github

Location of all reusable community health files
29 stars 65 forks source link

Slackify-markdown action fails when markdown code is used #231

Closed derberg closed 1 year ago

derberg commented 1 year ago

Describe the bug

Action https://github.com/asyncapi/.github/blob/master/.github/actions/slackify-markdown/action.yml has this

const md = `${{ inputs.markdown }}`;

GitHub Actions work the way that ${{ inputs.markdown }} is replaced with whatever is passed to it, so sometimes it looks like 👇🏼

const md = `[fix: workflow for windows assets download](https://github.com/asyncapi/cli/pull/539) 
   <!--   Thank you for your contribution. Before you submit the pull request:
  1. Follow our contribution guidelines
  2. Test your changes and attach their results to the pull request.
  3. Update the relevant documentation.
  -->

  **Description**

  This PR is updating the `upload-release-assets` workflow because it had issues with windows assets generation, which started due to `echo $npm_package_version`not working in windows. 
  `

so in between JavaScript ` you get another one because of usage of markdown code, like upload-release-assets.

so basically in const md =${{ inputs.markdown }}; we need to somehow make sure that inputs.markdown is properly escaped/sanitized

How to Reproduce

Yeah, create in any asyncapi repo issue or PR with something like test and you will see slack workflow failing and no notifications in slack, that something new was created

Expected behavior

yeah, any markdown content should work

smoya commented 1 year ago

In the meantime, the only workaround that worked for me was to remove either the whole PR description or those parts that are making the job to fail and after, push an empty commit (you can amend) in order to trigger a new CI build. Otherwise, trying to re-run jobs won't take the new PR description.