hashicorp / hashicorp/setup-terraform

Github Actions Terraform output with github-script has symbols / ascii characters

Open
#207 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.6k
Forks
288
Avg merge
23h 21m
Merged PRs (30d)
3

Description

Following the example setup where the outputs of Terraform Plan is added to the Pull Request as a comment. However there's all these ? type symbols that gets added in the comments.

versions:
hashicorp/setup-terraform@v2
actions/github-script@v6

my Github Actions YML File

```
# Generates an execution plan for Terraform
- name: Terraform Plan
id: plan
run: terraform plan -input=false
- uses: actions/github-script@v6
if: github.event_name == 'pull_request'
env:
PLAN: "terraform\n${{ steps.plan.outputs.stdout }}"
with:
script: |
const output = `#### Terraform Plan 📖\`${{ steps.plan.outcome }}\`

Show Plan

\`\`\`\n
${process.env.PLAN}
\`\`\`

*Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`;

github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})`

```

My condensed Output:

```
terraform
eastus2/providers/Microsoft.Compute/virtualMachines/vm-1]�[0m
�[0m�[1mazurerm_virtual_machine_extension.ext[0]: Refreshing state... [id=/subscriptions/redacted/resourceGroups/rg-eastus2/providers/Microsoft.Compute/virtualMachines/vm-1/extensions/customscript]�[0m

�[0m�[1m�[32mNo changes.�[0m�[1m Your infrastructure matches the configuration.�[0m
�[0mTerraform has compared your real infrastructure against your configuration
and found no differences, so no changes are needed.
```
`

Where do these question mark symbols come from. If I set my terraform plan to -no-color it'll remove the symbols. Is there any other work around?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.