Open jprecuch opened 1 year ago
Hi @jprecuch, thanks for sharing this. It seems that an underlying module (Markup.js) does it when a given input is undefined (source). Perhaps, to customize the behavior, passing empty string values instead in context can help.
I wanted to work on this issue, but I am having some trouble reproducing this behavior. Here's what I have in my workflow:
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: ["main"]
pull_request:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Send custom JSON data to Slack workflow
id: slack
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
"text": "This is an invalid environment variable: ${{ env.SAMPLE_ENV_VAR }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "This is an invalid environment variable: ${{ env.SAMPLE_ENV_VAR }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
SAMPLE_ENV_VAR
is the non-existing environment variable but I do not see ???
in the output:
Am I misunderstanding something?
I wanted to work on this issue, but I am having some trouble reproducing this behavior. ... Am I misunderstanding something?
yes. do it with payload-file-path
.
- name: "Slack Notify: Deployment Complete"
uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001
id: slack-notify
env:
SLACK_BOT_TOKEN: ${{ inputs.SlackBotToken }}
DEPLOYRELEASEBRANCH_APPNAME: ${{ inputs.AppName }}
DEPLOYRELEASEBRANCH_APPVERSION: ${{ inputs.AppVersion }}
DEPLOYRELEASEBRANCH_ENVIRONMENT: ${{ inputs.Environment }}
DEPLOYRELEASEBRANCH_JOBNAME: ${{ inputs.JobName }}
DEPLOYRELEASEBRANCH_JOBURL: ${{ inputs.JobUrl }}
DEPLOYRELEASEBRANCH_GITHUBACTOR: ${{ inputs.GithubActor }}
with:
channel-id: ${{ inputs.SlackChannelId }}
update-ts: ${{ inputs.MessageId }}
payload-file-path: ${{ github.action_path }}/slack-notification.json
Somewhat related, but missing github.*
variables in the payload-file-path
are also displayed as ???
. This specific case is being tracked over in #203!
Description
If a env variable which is in payload is missing, ??? are sent instead of empty value. It would be nice to not put ??? which confuses people but leave it empty (like empty variable).
What type of issue is this? (place an
x
in one of the[ ]
)Requirements (place an
x
in each of the[ ]
)Bug Report
Filling out the following details about bugs will help us solve your issue sooner.
Reproducible in:
package version: latest
Steps to reproduce:
Expected result:
Instead of ??? I would expect missing variable to be shown just empty value (bash behavior)
Actual result:
Instead of empty, we get confusing ???
Attachments:
For example: