This repository was archived by the owner on May 6, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +38
-5
lines changed
Expand file tree Collapse file tree 5 files changed +38
-5
lines changed Original file line number Diff line number Diff line change 11#! /bin/sh
22
3+ # stripcolors takes some output and removes ANSI color codes.
4+ stripcolors () {
5+ echo " $1 " | sed ' s/\x1b\[[0-9;]*m//g'
6+ }
7+
38# wrap takes some output and wraps it in a collapsible markdown section if
49# it's over $TF_ACTION_WRAP_LINES long.
510wrap () {
@@ -39,7 +44,7 @@ if [[ ! -z "$TF_ACTION_WORKSPACE" ]] && [[ "$TF_ACTION_WORKSPACE" != "default" ]
3944fi
4045
4146set +e
42- OUTPUT=$( sh -c " TF_IN_AUTOMATION=true terraform apply -no-color - auto-approve -input=false $* " 2>&1 )
47+ OUTPUT=$( sh -c " TF_IN_AUTOMATION=true terraform apply -auto-approve -input=false $* " 2>&1 )
4348SUCCESS=$?
4449echo " $OUTPUT "
4550set -e
@@ -52,6 +57,7 @@ if [ "$TF_ACTION_COMMENT" = "1" ] || [ "$TF_ACTION_COMMENT" = "false" ] || [ "$P
5257fi
5358
5459# Build the comment we'll post to the PR.
60+ OUTPUT=$( stripcolors " $OUTPUT " )
5561COMMENT=" "
5662if [ $SUCCESS -ne 0 ]; then
5763 OUTPUT=$( wrap " $OUTPUT " )
Original file line number Diff line number Diff line change 11#! /bin/sh
2+
3+ # stripcolors takes some output and removes ANSI color codes.
4+ stripcolors () {
5+ echo " $1 " | sed ' s/\x1b\[[0-9;]*m//g'
6+ }
7+
28set -e
39cd " ${TF_ACTION_WORKING_DIR:- .} "
410
511set +e
6- OUTPUT=$( sh -c " terraform fmt -no-color - check -list -recursive $* " 2>&1 )
12+ OUTPUT=$( sh -c " terraform fmt -check -list -recursive $* " 2>&1 )
713SUCCESS=$?
814echo " $OUTPUT "
915set -e
@@ -16,6 +22,7 @@ if [ "$TF_ACTION_COMMENT" = "1" ] || [ "$TF_ACTION_COMMENT" = "false" ]; then
1622 exit $SUCCESS
1723fi
1824
25+ OUTPUT=$( stripcolors " $OUTPUT " )
1926if [ $SUCCESS -eq 2 ]; then
2027 # If it exits with 2, then there was a parse error and the command won't have
2128 # printed out the files that have failed. In this case we comment back with the
Original file line number Diff line number Diff line change 11#! /bin/sh
2+
3+ # stripcolors takes some output and removes ANSI color codes.
4+ stripcolors () {
5+ echo " $1 " | sed ' s/\x1b\[[0-9;]*m//g'
6+ }
7+
28set -e
39cd " ${TF_ACTION_WORKING_DIR:- .} "
410
1218
1319set +e
1420export TF_APPEND_USER_AGENT=" terraform-github-actions/1.0"
15- OUTPUT=$( sh -c " terraform init -no-color - input=false $* " 2>&1 )
21+ OUTPUT=$( sh -c " terraform init -input=false $* " 2>&1 )
1622SUCCESS=$?
1723echo " $OUTPUT "
1824set -e
@@ -25,6 +31,7 @@ if [ "$TF_ACTION_COMMENT" = "1" ] || [ "$TF_ACTION_COMMENT" = "false" ]; then
2531 exit $SUCCESS
2632fi
2733
34+ OUTPUT=$( stripcolors " $OUTPUT " )
2835COMMENT=" #### \` terraform init\` Failed
2936\`\`\`
3037$OUTPUT
Original file line number Diff line number Diff line change 11#! /bin/sh
22
3+ # stripcolors takes some output and removes ANSI color codes.
4+ stripcolors () {
5+ echo " $1 " | sed ' s/\x1b\[[0-9;]*m//g'
6+ }
7+
38# wrap takes some output and wraps it in a collapsible markdown section if
49# it's over $TF_ACTION_WRAP_LINES long.
510wrap () {
@@ -39,7 +44,7 @@ if [[ ! -z "$TF_ACTION_WORKSPACE" ]] && [[ "$TF_ACTION_WORKSPACE" != "default" ]
3944fi
4045
4146set +e
42- OUTPUT=$( sh -c " TF_IN_AUTOMATION=true terraform plan -no-color - input=false $* " 2>&1 )
47+ OUTPUT=$( sh -c " TF_IN_AUTOMATION=true terraform plan -input=false $* " 2>&1 )
4348SUCCESS=$?
4449echo " $OUTPUT "
4550set -e
@@ -49,6 +54,7 @@ if [ "$TF_ACTION_COMMENT" = "1" ] || [ "$TF_ACTION_COMMENT" = "false" ]; then
4954fi
5055
5156# Build the comment we'll post to the PR.
57+ OUTPUT=$( stripcolors " $OUTPUT " )
5258COMMENT=" "
5359if [ $SUCCESS -ne 0 ]; then
5460 OUTPUT=$( wrap " $OUTPUT " )
Original file line number Diff line number Diff line change 11#! /bin/sh
2+
3+ # stripcolors takes some output and removes ANSI color codes.
4+ stripcolors () {
5+ echo " $1 " | sed ' s/\x1b\[[0-9;]*m//g'
6+ }
7+
28set -e
39cd " ${TF_ACTION_WORKING_DIR:- .} "
410
@@ -7,7 +13,7 @@ if [[ ! -z "$TF_ACTION_WORKSPACE" ]] && [[ "$TF_ACTION_WORKSPACE" != "default" ]
713fi
814
915set +e
10- OUTPUT=$( sh -c " terraform validate -no-color $* " 2>&1 )
16+ OUTPUT=$( sh -c " terraform validate $* " 2>&1 )
1117SUCCESS=$?
1218echo " $OUTPUT "
1319set -e
@@ -20,6 +26,7 @@ if [ "$TF_ACTION_COMMENT" = "1" ] || [ "$TF_ACTION_COMMENT" = "false" ]; then
2026 exit $SUCCESS
2127fi
2228
29+ OUTPUT=$( stripcolors " $OUTPUT " )
2330COMMENT=" #### \` terraform validate\` Failed
2431\`\`\`
2532$OUTPUT
You can’t perform that action at this time.
0 commit comments