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

Let plan action output the plan-output #119

Merged
merged 2 commits into from
Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Outputs are used to pass information to subsequent GitHub Actions steps.

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

## Secrets

Expand Down
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ outputs:
description: 'The Terraform outputs in JSON format.'
tf_actions_plan_has_changes:
description: 'Whether or not the Terraform plan contained changes.'
tf_actions_plan_output:
description: 'The Terraform plan output.'
runs:
using: 'docker'
image: './Dockerfile'
7 changes: 7 additions & 0 deletions src/terraform_plan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,12 @@ ${planOutput}
fi

echo ::set-output name=tf_actions_plan_has_changes::${planHasChanges}

# https://github.saobby.my.eu.orgmunity/t5/GitHub-Actions/set-output-Truncates-Multiline-Strings/m-p/38372/highlight/true#M3322
planOutput="${planOutput//'%'/'%25'}"
planOutput="${planOutput//$'\n'/'%0A'}"
planOutput="${planOutput//$'\r'/'%0D'}"

echo "::set-output name=tf_actions_plan_output::${planOutput}"
exit ${planExitCode}
}