Skip to content
This repository was archived by the owner on May 6, 2020. It is now read-only.

Commit 3fb381d

Browse files
jvassbosudomateo
andauthored
Let plan action output the plan-output (#119)
* Ouput the plan output for subsequent actions * Follow Github's recommendation for mulit-line string output Co-Authored-By: Matthew Sanabria <[email protected]> Co-authored-by: Matthew Sanabria <[email protected]>
1 parent 8b26ef2 commit 3fb381d

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ Outputs are used to pass information to subsequent GitHub Actions steps.
8282

8383
* `tf_actions_output` - The Terraform outputs in JSON format.
8484
* `tf_actions_plan_has_changes` - Whether or not the Terraform plan contained changes.
85+
* `tf_actions_plan_output` - The Terraform plan output.
8586

8687
## Secrets
8788

action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ outputs:
2727
description: 'The Terraform outputs in JSON format.'
2828
tf_actions_plan_has_changes:
2929
description: 'Whether or not the Terraform plan contained changes.'
30+
tf_actions_plan_output:
31+
description: 'The Terraform plan output.'
3032
runs:
3133
using: 'docker'
3234
image: './Dockerfile'

src/terraform_plan.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,12 @@ ${planOutput}
6363
fi
6464

6565
echo ::set-output name=tf_actions_plan_has_changes::${planHasChanges}
66+
67+
# https://github.community/t5/GitHub-Actions/set-output-Truncates-Multiline-Strings/m-p/38372/highlight/true#M3322
68+
planOutput="${planOutput//'%'/'%25'}"
69+
planOutput="${planOutput//$'\n'/'%0A'}"
70+
planOutput="${planOutput//$'\r'/'%0D'}"
71+
72+
echo "::set-output name=tf_actions_plan_output::${planOutput}"
6673
exit ${planExitCode}
6774
}

0 commit comments

Comments
 (0)