-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
29 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,15 +111,10 @@ jobs: | |
variables: ${{ env.TF_VARS }} | ||
auto_approve: true | ||
|
||
- name: Create Summary Output | ||
- name: Summary | ||
if: steps.tf_apply.outputs != '' | ||
id: tf_outputs_summary | ||
run: | | ||
echo "Summary" >> $GITHUB_STEP_SUMMARY | ||
echo "<details>" >> $GITHUB_STEP_SUMMARY | ||
echo "<summary>Terraform Outputs</summary>" >> $GITHUB_STEP_SUMMARY | ||
echo "" >> $GITHUB_STEP_SUMMARY | ||
echo '```' >> $GITHUB_STEP_SUMMARY | ||
echo "${{ toJson(steps.tf_apply.outputs) }}" >> $GITHUB_STEP_SUMMARY | ||
echo '```' >> $GITHUB_STEP_SUMMARY | ||
echo "</details>" >> $GITHUB_STEP_SUMMARY | ||
uses: tx-pts-dai/[email protected] | ||
with: | ||
summary_header: "Terraform Outputs" | ||
string: ${{ toJson(steps.tf_apply.outputs) }} | ||
data_type: "json" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,15 +126,10 @@ jobs: | |
variables: ${{ env.TF_VARS }} | ||
auto_approve: true | ||
|
||
- name: Create Summary Output | ||
- name: Summary | ||
if: steps.tf_apply.outputs != '' | ||
id: tf_outputs_summary | ||
run: | | ||
echo "Summary" >> $GITHUB_STEP_SUMMARY | ||
echo "<details>" >> $GITHUB_STEP_SUMMARY | ||
echo "<summary>Terraform Outputs</summary>" >> $GITHUB_STEP_SUMMARY | ||
echo "" >> $GITHUB_STEP_SUMMARY | ||
echo '```' >> $GITHUB_STEP_SUMMARY | ||
echo "${{ toJson(steps.tf_apply.outputs) }}" >> $GITHUB_STEP_SUMMARY | ||
echo '```' >> $GITHUB_STEP_SUMMARY | ||
echo "</details>" >> $GITHUB_STEP_SUMMARY | ||
uses: tx-pts-dai/[email protected] | ||
with: | ||
summary_header: "Terraform Outputs" | ||
string: ${{ toJson(steps.tf_apply.outputs) }} | ||
data_type: "json" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,38 +125,10 @@ jobs: | |
var_file: ${{ env.TF_VAR_FILES }} | ||
variables: ${{ env.TF_VARS }} | ||
|
||
# TODO Convert to composite run steps | ||
- name: Create String Output | ||
- name: Summary | ||
if: github.event_name == 'pull_request' | ||
id: tf-plan-string | ||
env: | ||
TERRAFORM_PLAN_PATH: ${{ steps.plan.outputs.text_plan_path }} | ||
run: | | ||
MAX_PLAN_LENGTH=120000 | ||
TERRAFORM_PLAN=$(cat $TERRAFORM_PLAN_PATH) | ||
TERRAFORM_SUMMARY_HEADER=$(grep -E -i -m 1 'No changes|Plan:|Outputs:' <<< "$TERRAFORM_PLAN") | ||
PLAN_LENGTH=${#TERRAFORM_PLAN} | ||
START=$((PLAN_LENGTH - MAX_PLAN_LENGTH)) | ||
if [ "$START" -lt 0 ]; then | ||
SHORT_PLAN=${TERRAFORM_PLAN} | ||
else | ||
echo ":warning: Plan output is too long to be displayed (${PLAN_LENGTH} chars). Only the last ${MAX_PLAN_LENGTH} characters will be printed. " | ||
SHORT_PLAN=${TERRAFORM_PLAN:START:MAX_PLAN_LENGTH} | ||
fi | ||
delimiter="$(openssl rand -hex 8)" | ||
echo "summary<<${delimiter}" >> $GITHUB_OUTPUT | ||
echo "$TERRAFORM_SUMMARY_HEADER" >> $GITHUB_OUTPUT | ||
echo "<details><summary>Click to expand</summary>" >> $GITHUB_OUTPUT | ||
echo "" >> $GITHUB_OUTPUT | ||
echo '```terraform' >> $GITHUB_OUTPUT | ||
echo "${SHORT_PLAN}" >> $GITHUB_OUTPUT | ||
echo '```' >> $GITHUB_OUTPUT | ||
echo "</details>" >> $GITHUB_OUTPUT | ||
echo "${delimiter}" >> $GITHUB_OUTPUT | ||
- name: Publish Terraform Plan to Task Summary | ||
if: github.event_name == 'pull_request' | ||
env: | ||
SUMMARY: ${{ steps.tf-plan-string.outputs.summary }} | ||
run: | | ||
echo "$SUMMARY" >> $GITHUB_STEP_SUMMARY | ||
uses: tx-pts-dai/[email protected] | ||
with: | ||
summary_header: "Terraform Plan" | ||
path: ${{ steps.plan.outputs.text_plan_path }} | ||
data_type: "terraform" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters