rtCamp/action-slack-notify

Still unable to show multiline messages correctly

yoavniran opened this issue · 0 comments

I've seen and tried the suggestions in #106

Opening a new issue in the hope it will be addressed or seen by someone who can help:

this is what im doing (shortened...):

    - name: Get log between tags
      id: release-log
      shell: bash
      run: |
        ...
        gitcommits=$(git log previousTag..HEAD --pretty=format:"%h %s - %an %B %n" -- ${{ inputs.logRoot }}/) 
        echo "### Git commits since Last Tag 📒" >> $GITHUB_STEP_SUMMARY
        echo "" >> $GITHUB_STEP_SUMMARY
        while IFS= read -r line; do
         echo $line >> $GITHUB_STEP_SUMMARY
        done <<< "$gitcommits"
        echo "RELEASE-LOG=${gitcommits//$'\n'/'%0A'}" >> "$GITHUB_OUTPUT"


      - name: Slack notification for successful deployment
        if: ${{ always() && steps.s3-deploy.outcome == 'success' }}
        uses: rtCamp/action-slack-notify@v2.2.0
        env:
         ...
          SLACK_MESSAGE: "Log: ${{ steps.release-log.outputs.RELEASE-LOG }}"

Im using the "trick" of replacing the new-line char (//$'\n'/'%0A') but the message I get in slack is one big blob with the lines separated by: "%0A %0A%0A" characters.
So looks like the replace works but either something is wrong in the replace op or Slack ignores the new chars...