slackapi/slack-github-action

Formatting text in Slack payload as bold

pantelis-karamolegkos opened this issue · 2 comments

Description

Describe your issue here.

What type of issue is this? (place an x in one of the [ ])

  • bug
  • enhancement (feature request)
  • question
  • documentation related
  • example code related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've searched for any related issues and avoided creating a duplicate issue.

I am using the official action for posting Slack messages.

I am composing the payload using the actions script as follows:

  - name: construct slack payload
      id: set-slack-payload
      uses: actions/github-script@v7
      with:
        script: |
          const payload = {
            "text": "Docker Image Build for ${{ inputs.image_name }}: ${{ inputs.success && '**Success**' || '**Epic Failure**' }}",
            "username": "Image Building Workflow",
            "icon_url": "https://www.icons.com/myicon.png",
            "attachments": [
              {

Placing the Success / Failure words inside ** does not format the words as bold.

How can this be done?

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

package version:

node version:

OS version(s):

Steps to reproduce:

Expected result:

What you expected to happen

Actual result:

What actually happened

Attachments:

Logs, screenshots, screencast, sample project, funny gif, etc.

Hey @pantelis-karamolegkos! Glad this issue was completed but I'm really curious what the fix was? I'm not so familiar with actions/github-script@v7 so might guess something strange was happening with it 🤔

@zimeg the solution was to add single * around the word I wanted formatted as bold, as in

 "text": "Docker Image Build for ${{ inputs.image_name }}: ${{ inputs.success && '*Success*' || '*Epic Failure*' }}",