Description
Multilines with special characters in the logs read from $GITHUB_OUTPUT variable results in the following error. This is working in 1.27.1
Invalid input! Failed to parse contents of the provided payload.
What type of issue is this?
Requirements
Steps to reproduce:
Posting the relevent workflow steps:
Suppose a workflow has a simple step as follows:
- name: Test
run: |
echo "Exiting now"
exit 1
And now I want read the logs of the above failed workflow and for that I use the below steps in a different workflow with the run_id of the above workflow, it results into an error as mentioned above.
- name: Get failed job/step logs
id: fail_msg
run: |
error_log=$(gh run view ${{ inputs.run_id }} --log-failed -R ${{ inputs.repo_name }})
{
echo 'get_log<<EOF'
echo "workflow failed with the following error:"
echo "$error_log"
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Post to Slack
uses: slackapi/slack-github-action@v2.0.0
with:
method: chat.postMessage
token: ${{ secrets.thisissecret }}
payload: |
channel: "${{ inputs.channel-id }}"
text: "${{ steps.fail_msg.outputs.get_log }}"
Expected result:
Should send the logs to slack as expected
Attachments:
file:///opt/actions-runner/_work/_actions/slackapi/slack-github-action/v2.0.0
throw new SlackError(
^
SlackError: Invalid input! Failed to parse contents of the provided payload
at Content.getContentPayload (file:///opt/actions-runner/_work/_actions/s
at Content.get (file:///opt/actions-runner/_work/_actions/slackapi/slack-
at new Config (file:///opt/actions-runner/_work/_actions/slackapi/slack-g
at send (file:///opt/actions-runner/_work/_actions/slackapi/slack-github-
at file:///opt/actions-runner/_work/_actions/slackapi/slack-github-action
at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
at ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)
Description
Multilines with special characters in the logs read from $GITHUB_OUTPUT variable results in the following error. This is working in 1.27.1
What type of issue is this?
Requirements
Steps to reproduce:
Posting the relevent workflow steps:
Suppose a workflow has a simple step as follows:
And now I want read the logs of the above failed workflow and for that I use the below steps in a different workflow with the run_id of the above workflow, it results into an error as mentioned above.
Expected result:
Should send the logs to slack as expected
Attachments:
file:///opt/actions-runner/_work/_actions/slackapi/slack-github-action/v2.0.0 throw new SlackError( ^ SlackError: Invalid input! Failed to parse contents of the provided payload at Content.getContentPayload (file:///opt/actions-runner/_work/_actions/s at Content.get (file:///opt/actions-runner/_work/_actions/slackapi/slack- at new Config (file:///opt/actions-runner/_work/_actions/slackapi/slack-g at send (file:///opt/actions-runner/_work/_actions/slackapi/slack-github- at file:///opt/actions-runner/_work/_actions/slackapi/slack-github-action at ModuleJob.run (node:internal/modules/esm/module_job:222:25) at ModuleLoader.import (node:internal/modules/esm/loader:316:24) at asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)