From ff275fe20fb03bb1a84c59a529b43b1a3a9bd56d Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Thu, 7 Nov 2024 23:29:27 +0000 Subject: [PATCH 1/8] feat: show-args parameter Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- README.md | 3 ++- action.yml | 31 ++++++++++++++++++++++--------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 9d1a8e4c..149e87d3 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,8 @@ For each workflow run, a matrix-friendly job summary with logs is added as a fal | Security | `token` | Specify a GitHub token.
Default: `${{ github.token }}` | | UI | `comment-pr` | PR comment by: `update` existing comment, `recreate` and delete previous one, or `none`.
Default: `update` | | UI | `label-pr` | Add a PR label with the command input.
Default: `true` | -| UI | `hide-args` | Hide comma-separated list of CLI arguments from the command input.
Default: `detailed-exitcode,lock,out,var` | +| UI | `hide-args` | Hide comma-separated list of CLI arguments from the command input.
Default: `detailed-exitcode,lock,out,var=` | +| UI | `show-args` | Show comma-separated list of CLI arguments in the command input.
Default: `workspace` |
The default behavior of `comment-pr` is to update the existing PR comment with the latest plan output, making it easy to track changes over time through the comment's revision history.
diff --git a/action.yml b/action.yml index 6a854b0f..e0a54e9d 100644 --- a/action.yml +++ b/action.yml @@ -66,6 +66,7 @@ runs: echo arg-var-file=$([[ -n "${{ inputs.arg-var-file }}" ]] && echo " -var-file=${{ inputs.arg-var-file }}" || echo "") >> "$GITHUB_OUTPUT" echo arg-var=$([[ -n "${{ inputs.arg-var }}" ]] && echo " -var=${{ inputs.arg-var }}" | sed "s/,/ -var=/g" || echo "") >> "$GITHUB_OUTPUT" echo arg-write=$([[ -n "${{ inputs.arg-write }}" ]] && echo " -write=${{ inputs.arg-write }}" || echo "") >> "$GITHUB_OUTPUT" + echo arg-workspace=$([[ -n "${{ inputs.arg-workspace }}" ]] && echo " -workspace=${{ inputs.arg-workspace }}" || echo "") >> "$GITHUB_OUTPUT" - id: identifier env: @@ -203,7 +204,7 @@ runs: # Diff of changes. # Filter lines starting with " # " and save to tf.diff.txt, then prepend diff-specific symbols based on specific keywords. - grep -E '^ # ' tf.console.txt | sed -e 's/^ # \(.* be created\)/+ \1/' -e 's/^ # \(.* be destroyed\)/- \1/' -e 's/^ # \(.* be updated\|.* be replaced\)/! \1/' -e 's/^ # \(.* be read\)/~ \1/' -e 's/^ # \(.*\)/# \1/' > tf.diff.txt || true + grep '^ # ' tf.console.txt | sed -e 's/^ # \(.* be created\)/+ \1/' -e 's/^ # \(.* be destroyed\)/- \1/' -e 's/^ # \(.* be updated\|.* be replaced\)/! \1/' -e 's/^ # \(.* be read\)/~ \1/' -e 's/^ # \(.*\)/# \1/' > tf.diff.txt || true - if: ${{ inputs.plan-encrypt != '' && steps.plan.outcome == 'success' }} env: @@ -267,12 +268,20 @@ runs: # Parse the tf.command.txt file. command=$(cat tf.command.txt) - # Remove each comma-delemited argument from the command. - IFS=',' read -ra args <<< "${{ inputs.hide-args }}=" - for arg in "${args[@]}"; do - command=$(echo "$command" | grep --invert-match "^ -${arg}\b") + # Remove each comma-delemited hide-args argument from the command. + IFS=',' read -ra hide_args <<< "${{ inputs.hide-args }}" + for arg in "${hide_args[@]}"; do + command=$(echo "$command" | grep --invert-match "^ -${arg}") done - command=$(echo "$command" | tr -d '\n') + + # Conversely, show each comma-delemited show-args argument in the command. + IFS=',' read -ra show_args <<< "${{ inputs.show-args }}" + command_append="" + for arg in "${show_args[@]}"; do + command_append+=$(echo "${{ steps.arg.outputs.arg-workspace }}${{ steps.arg.outputs.arg-auto-approve }}${{ steps.arg.outputs.arg-backend-config }}${{ steps.arg.outputs.arg-backend }}${{ steps.arg.outputs.arg-backup }}${{ steps.arg.outputs.arg-check }}${{ steps.arg.outputs.arg-compact-warnings }}${{ steps.arg.outputs.arg-concise }}${{ steps.arg.outputs.arg-destroy }}${{ steps.arg.outputs.arg-detailed-exitcode }}${{ steps.arg.outputs.arg-diff }}${{ steps.arg.outputs.arg-force-copy }}${{ steps.arg.outputs.arg-from-module }}${{ steps.arg.outputs.arg-generate-config-out }}${{ steps.arg.outputs.arg-get }}${{ steps.arg.outputs.arg-list }}${{ steps.arg.outputs.arg-lock-timeout }}${{ steps.arg.outputs.arg-lock }}${{ steps.arg.outputs.arg-lockfile }}${{ steps.arg.outputs.arg-migrate-state }}${{ steps.arg.outputs.arg-no-tests }}${{ steps.arg.outputs.arg-or-create }}${{ steps.arg.outputs.arg-parallelism }}${{ steps.arg.outputs.arg-plugin-dir }}${{ steps.arg.outputs.arg-reconfigure }}${{ steps.arg.outputs.arg-recursive }}${{ steps.arg.outputs.arg-refresh-only }}${{ steps.arg.outputs.arg-refresh }}${{ steps.arg.outputs.arg-replace }}${{ steps.arg.outputs.arg-state-out }}${{ steps.arg.outputs.arg-state }}${{ steps.arg.outputs.arg-target }}${{ steps.arg.outputs.arg-test-directory }}${{ steps.arg.outputs.arg-upgrade }}${{ steps.arg.outputs.arg-var-file }}${{ steps.arg.outputs.arg-var }}${{ steps.arg.outputs.arg-write }}" | sed 's/ -/\n -/g' | grep "^ -${arg}") + done + + command=$(echo "$command" | tr -d '\n')$command_append echo "command=$command" >> "$GITHUB_OUTPUT" # Parse the tf.console.txt file, truncated for character limit. @@ -356,7 +365,7 @@ runs: if [[ "${{ inputs.comment-pr }}" != "none" && "${{ steps.identifier.outputs.pr }}" != "0" ]]; then # Check if the PR contains a bot comment with the same identifier. list_comments=$(gh api /repos/${GITHUB_REPOSITORY}/issues/${{ steps.identifier.outputs.pr }}/comments --header "$GH_API" --method GET --field per_page=100) - bot_comment=$(echo "$list_comments" | jq --raw-output --arg identifier "${{ steps.identifier.outputs.name }}" '.[] | select(.user.type == "Bot") | select(.body | contains($identifier)) | .id' | tail -n 1) + bot_comment=$(echo "$list_comments" | jq --raw-output --arg identifier "${{ steps.identifier.outputs.name }}" '.[] | select(.user.type == "Bot") | select(.body | contains($identifier)) | .id' | head -n 1) if [[ -n "$bot_comment" ]]; then if [[ "${{ inputs.comment-pr }}" == "recreate" ]]; then @@ -432,8 +441,8 @@ inputs: description: "Check format of TF code (e.g., `false`)." required: false hide-args: - default: "detailed-exitcode,lock,out,var" - description: "Hide comma-separated arguments from the command input (e.g., `detailed-exitcode,lock,out,var`)." + default: "detailed-exitcode,lock,out,var=" + description: "Hide comma-separated arguments from the command input (e.g., `detailed-exitcode,lock,out,var=`)." required: false label-pr: default: "true" @@ -447,6 +456,10 @@ inputs: default: "false" description: "Replace the plan file if it matches a newly-generated one to prevent stale apply (e.g., `false`)." required: false + show-args: + default: "workspace" + description: "Show comma-separated arguments in the command input (e.g., `workspace`)." + required: false token: default: ${{ github.token }} description: "Specify a GitHub token (e.g., `secrets.GITHUB_TOKEN`)." From cb654feb8e12f321d20508465163ff96fee6ecf0 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Thu, 7 Nov 2024 23:40:00 +0000 Subject: [PATCH 2/8] reorder show-args Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index e0a54e9d..090cb3a1 100644 --- a/action.yml +++ b/action.yml @@ -278,7 +278,7 @@ runs: IFS=',' read -ra show_args <<< "${{ inputs.show-args }}" command_append="" for arg in "${show_args[@]}"; do - command_append+=$(echo "${{ steps.arg.outputs.arg-workspace }}${{ steps.arg.outputs.arg-auto-approve }}${{ steps.arg.outputs.arg-backend-config }}${{ steps.arg.outputs.arg-backend }}${{ steps.arg.outputs.arg-backup }}${{ steps.arg.outputs.arg-check }}${{ steps.arg.outputs.arg-compact-warnings }}${{ steps.arg.outputs.arg-concise }}${{ steps.arg.outputs.arg-destroy }}${{ steps.arg.outputs.arg-detailed-exitcode }}${{ steps.arg.outputs.arg-diff }}${{ steps.arg.outputs.arg-force-copy }}${{ steps.arg.outputs.arg-from-module }}${{ steps.arg.outputs.arg-generate-config-out }}${{ steps.arg.outputs.arg-get }}${{ steps.arg.outputs.arg-list }}${{ steps.arg.outputs.arg-lock-timeout }}${{ steps.arg.outputs.arg-lock }}${{ steps.arg.outputs.arg-lockfile }}${{ steps.arg.outputs.arg-migrate-state }}${{ steps.arg.outputs.arg-no-tests }}${{ steps.arg.outputs.arg-or-create }}${{ steps.arg.outputs.arg-parallelism }}${{ steps.arg.outputs.arg-plugin-dir }}${{ steps.arg.outputs.arg-reconfigure }}${{ steps.arg.outputs.arg-recursive }}${{ steps.arg.outputs.arg-refresh-only }}${{ steps.arg.outputs.arg-refresh }}${{ steps.arg.outputs.arg-replace }}${{ steps.arg.outputs.arg-state-out }}${{ steps.arg.outputs.arg-state }}${{ steps.arg.outputs.arg-target }}${{ steps.arg.outputs.arg-test-directory }}${{ steps.arg.outputs.arg-upgrade }}${{ steps.arg.outputs.arg-var-file }}${{ steps.arg.outputs.arg-var }}${{ steps.arg.outputs.arg-write }}" | sed 's/ -/\n -/g' | grep "^ -${arg}") + command_append+=$(echo "${{ steps.arg.outputs.arg-workspace }}${{ steps.arg.outputs.arg-backend-config }}${{ steps.arg.outputs.arg-backend }}${{ steps.arg.outputs.arg-backup }}${{ steps.arg.outputs.arg-check }}${{ steps.arg.outputs.arg-compact-warnings }}${{ steps.arg.outputs.arg-concise }}${{ steps.arg.outputs.arg-destroy }}${{ steps.arg.outputs.arg-detailed-exitcode }}${{ steps.arg.outputs.arg-diff }}${{ steps.arg.outputs.arg-force-copy }}${{ steps.arg.outputs.arg-from-module }}${{ steps.arg.outputs.arg-generate-config-out }}${{ steps.arg.outputs.arg-get }}${{ steps.arg.outputs.arg-list }}${{ steps.arg.outputs.arg-lock-timeout }}${{ steps.arg.outputs.arg-lock }}${{ steps.arg.outputs.arg-lockfile }}${{ steps.arg.outputs.arg-migrate-state }}${{ steps.arg.outputs.arg-no-tests }}${{ steps.arg.outputs.arg-or-create }}${{ steps.arg.outputs.arg-parallelism }}${{ steps.arg.outputs.arg-plugin-dir }}${{ steps.arg.outputs.arg-reconfigure }}${{ steps.arg.outputs.arg-recursive }}${{ steps.arg.outputs.arg-refresh-only }}${{ steps.arg.outputs.arg-refresh }}${{ steps.arg.outputs.arg-replace }}${{ steps.arg.outputs.arg-state-out }}${{ steps.arg.outputs.arg-state }}${{ steps.arg.outputs.arg-target }}${{ steps.arg.outputs.arg-test-directory }}${{ steps.arg.outputs.arg-upgrade }}${{ steps.arg.outputs.arg-var-file }}${{ steps.arg.outputs.arg-var }}${{ steps.arg.outputs.arg-write }}${{ steps.arg.outputs.arg-auto-approve }}" | sed 's/ -/\n -/g' | grep "^ -${arg}") done command=$(echo "$command" | tr -d '\n')$command_append From d5adb28e928e8a58a2103e4cda2f87170f30299e Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Thu, 7 Nov 2024 23:42:06 +0000 Subject: [PATCH 3/8] sync Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 090cb3a1..0c4cef66 100644 --- a/action.yml +++ b/action.yml @@ -365,7 +365,7 @@ runs: if [[ "${{ inputs.comment-pr }}" != "none" && "${{ steps.identifier.outputs.pr }}" != "0" ]]; then # Check if the PR contains a bot comment with the same identifier. list_comments=$(gh api /repos/${GITHUB_REPOSITORY}/issues/${{ steps.identifier.outputs.pr }}/comments --header "$GH_API" --method GET --field per_page=100) - bot_comment=$(echo "$list_comments" | jq --raw-output --arg identifier "${{ steps.identifier.outputs.name }}" '.[] | select(.user.type == "Bot") | select(.body | contains($identifier)) | .id' | head -n 1) + bot_comment=$(echo "$list_comments" | jq --raw-output --arg identifier "${{ steps.identifier.outputs.name }}" '.[] | select(.user.type == "Bot") | select(.body | contains($identifier)) | .id' | tail -n 1) if [[ -n "$bot_comment" ]]; then if [[ "${{ inputs.comment-pr }}" == "recreate" ]]; then From 6563fba704aafeb4119b031bd65096e27449f667 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Thu, 7 Nov 2024 23:46:27 +0000 Subject: [PATCH 4/8] amend tests workflow trigger Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tf_tests.yaml b/.github/workflows/tf_tests.yaml index bbf7717d..3bc60d8f 100644 --- a/.github/workflows/tf_tests.yaml +++ b/.github/workflows/tf_tests.yaml @@ -3,7 +3,7 @@ name: TF Tests on: pull_request: - paths: [.github/workflows/tf_tests.yaml, tests/**] + paths: [.github/workflows/tf_tests.yaml, action.yml, tests/**] types: [opened, reopened, synchronize, closed] jobs: From a6fd0607cd3f9794938a908213093af2a9881466 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Fri, 8 Nov 2024 00:45:16 +0000 Subject: [PATCH 5/8] debug messages Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yaml | 8 ++++---- action.yml | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tf_tests.yaml b/.github/workflows/tf_tests.yaml index 3bc60d8f..0002fdc4 100644 --- a/.github/workflows/tf_tests.yaml +++ b/.github/workflows/tf_tests.yaml @@ -21,10 +21,10 @@ jobs: matrix: test: - pass_one - - pass_character_limit - - fail_data_source_error - - fail_format_diff - - fail_invalid_resource_type + # - pass_character_limit + # - fail_data_source_error + # - fail_format_diff + # - fail_invalid_resource_type steps: - name: Echo context diff --git a/action.yml b/action.yml index 0c4cef66..3747a5bb 100644 --- a/action.yml +++ b/action.yml @@ -267,20 +267,20 @@ runs: # Post output. # Parse the tf.command.txt file. command=$(cat tf.command.txt) - + echo "debug: 1" # Remove each comma-delemited hide-args argument from the command. IFS=',' read -ra hide_args <<< "${{ inputs.hide-args }}" for arg in "${hide_args[@]}"; do command=$(echo "$command" | grep --invert-match "^ -${arg}") done - + echo "debug: 2" # Conversely, show each comma-delemited show-args argument in the command. IFS=',' read -ra show_args <<< "${{ inputs.show-args }}" command_append="" for arg in "${show_args[@]}"; do command_append+=$(echo "${{ steps.arg.outputs.arg-workspace }}${{ steps.arg.outputs.arg-backend-config }}${{ steps.arg.outputs.arg-backend }}${{ steps.arg.outputs.arg-backup }}${{ steps.arg.outputs.arg-check }}${{ steps.arg.outputs.arg-compact-warnings }}${{ steps.arg.outputs.arg-concise }}${{ steps.arg.outputs.arg-destroy }}${{ steps.arg.outputs.arg-detailed-exitcode }}${{ steps.arg.outputs.arg-diff }}${{ steps.arg.outputs.arg-force-copy }}${{ steps.arg.outputs.arg-from-module }}${{ steps.arg.outputs.arg-generate-config-out }}${{ steps.arg.outputs.arg-get }}${{ steps.arg.outputs.arg-list }}${{ steps.arg.outputs.arg-lock-timeout }}${{ steps.arg.outputs.arg-lock }}${{ steps.arg.outputs.arg-lockfile }}${{ steps.arg.outputs.arg-migrate-state }}${{ steps.arg.outputs.arg-no-tests }}${{ steps.arg.outputs.arg-or-create }}${{ steps.arg.outputs.arg-parallelism }}${{ steps.arg.outputs.arg-plugin-dir }}${{ steps.arg.outputs.arg-reconfigure }}${{ steps.arg.outputs.arg-recursive }}${{ steps.arg.outputs.arg-refresh-only }}${{ steps.arg.outputs.arg-refresh }}${{ steps.arg.outputs.arg-replace }}${{ steps.arg.outputs.arg-state-out }}${{ steps.arg.outputs.arg-state }}${{ steps.arg.outputs.arg-target }}${{ steps.arg.outputs.arg-test-directory }}${{ steps.arg.outputs.arg-upgrade }}${{ steps.arg.outputs.arg-var-file }}${{ steps.arg.outputs.arg-var }}${{ steps.arg.outputs.arg-write }}${{ steps.arg.outputs.arg-auto-approve }}" | sed 's/ -/\n -/g' | grep "^ -${arg}") done - + echo "debug: 3" command=$(echo "$command" | tr -d '\n')$command_append echo "command=$command" >> "$GITHUB_OUTPUT" From eca299f7bc9086f1f6e939dc4b1cca2d1c3fd5f0 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Fri, 8 Nov 2024 00:54:02 +0000 Subject: [PATCH 6/8] try this on for size Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yaml | 2 +- action.yml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tf_tests.yaml b/.github/workflows/tf_tests.yaml index 0002fdc4..ddcb6630 100644 --- a/.github/workflows/tf_tests.yaml +++ b/.github/workflows/tf_tests.yaml @@ -45,7 +45,7 @@ jobs: - name: Provision TF id: tf - continue-on-error: true + # continue-on-error: true uses: ./ with: command: ${{ github.event.pull_request.merged && 'apply' || 'plan' }} diff --git a/action.yml b/action.yml index 3747a5bb..dadf54e7 100644 --- a/action.yml +++ b/action.yml @@ -267,20 +267,20 @@ runs: # Post output. # Parse the tf.command.txt file. command=$(cat tf.command.txt) - echo "debug: 1" + # Remove each comma-delemited hide-args argument from the command. IFS=',' read -ra hide_args <<< "${{ inputs.hide-args }}" for arg in "${hide_args[@]}"; do command=$(echo "$command" | grep --invert-match "^ -${arg}") done - echo "debug: 2" + # Conversely, show each comma-delemited show-args argument in the command. - IFS=',' read -ra show_args <<< "${{ inputs.show-args }}" command_append="" + IFS=',' read -ra show_args <<< "${{ inputs.show-args }}" for arg in "${show_args[@]}"; do - command_append+=$(echo "${{ steps.arg.outputs.arg-workspace }}${{ steps.arg.outputs.arg-backend-config }}${{ steps.arg.outputs.arg-backend }}${{ steps.arg.outputs.arg-backup }}${{ steps.arg.outputs.arg-check }}${{ steps.arg.outputs.arg-compact-warnings }}${{ steps.arg.outputs.arg-concise }}${{ steps.arg.outputs.arg-destroy }}${{ steps.arg.outputs.arg-detailed-exitcode }}${{ steps.arg.outputs.arg-diff }}${{ steps.arg.outputs.arg-force-copy }}${{ steps.arg.outputs.arg-from-module }}${{ steps.arg.outputs.arg-generate-config-out }}${{ steps.arg.outputs.arg-get }}${{ steps.arg.outputs.arg-list }}${{ steps.arg.outputs.arg-lock-timeout }}${{ steps.arg.outputs.arg-lock }}${{ steps.arg.outputs.arg-lockfile }}${{ steps.arg.outputs.arg-migrate-state }}${{ steps.arg.outputs.arg-no-tests }}${{ steps.arg.outputs.arg-or-create }}${{ steps.arg.outputs.arg-parallelism }}${{ steps.arg.outputs.arg-plugin-dir }}${{ steps.arg.outputs.arg-reconfigure }}${{ steps.arg.outputs.arg-recursive }}${{ steps.arg.outputs.arg-refresh-only }}${{ steps.arg.outputs.arg-refresh }}${{ steps.arg.outputs.arg-replace }}${{ steps.arg.outputs.arg-state-out }}${{ steps.arg.outputs.arg-state }}${{ steps.arg.outputs.arg-target }}${{ steps.arg.outputs.arg-test-directory }}${{ steps.arg.outputs.arg-upgrade }}${{ steps.arg.outputs.arg-var-file }}${{ steps.arg.outputs.arg-var }}${{ steps.arg.outputs.arg-write }}${{ steps.arg.outputs.arg-auto-approve }}" | sed 's/ -/\n -/g' | grep "^ -${arg}") + command_append+=$(echo "${{ steps.arg.outputs.arg-workspace }}${{ steps.arg.outputs.arg-backend-config }}${{ steps.arg.outputs.arg-backend }}${{ steps.arg.outputs.arg-backup }}${{ steps.arg.outputs.arg-check }}${{ steps.arg.outputs.arg-compact-warnings }}${{ steps.arg.outputs.arg-concise }}${{ steps.arg.outputs.arg-destroy }}${{ steps.arg.outputs.arg-detailed-exitcode }}${{ steps.arg.outputs.arg-diff }}${{ steps.arg.outputs.arg-force-copy }}${{ steps.arg.outputs.arg-from-module }}${{ steps.arg.outputs.arg-generate-config-out }}${{ steps.arg.outputs.arg-get }}${{ steps.arg.outputs.arg-list }}${{ steps.arg.outputs.arg-lock-timeout }}${{ steps.arg.outputs.arg-lock }}${{ steps.arg.outputs.arg-lockfile }}${{ steps.arg.outputs.arg-migrate-state }}${{ steps.arg.outputs.arg-no-tests }}${{ steps.arg.outputs.arg-or-create }}${{ steps.arg.outputs.arg-parallelism }}${{ steps.arg.outputs.arg-plugin-dir }}${{ steps.arg.outputs.arg-reconfigure }}${{ steps.arg.outputs.arg-recursive }}${{ steps.arg.outputs.arg-refresh-only }}${{ steps.arg.outputs.arg-refresh }}${{ steps.arg.outputs.arg-replace }}${{ steps.arg.outputs.arg-state-out }}${{ steps.arg.outputs.arg-state }}${{ steps.arg.outputs.arg-target }}${{ steps.arg.outputs.arg-test-directory }}${{ steps.arg.outputs.arg-upgrade }}${{ steps.arg.outputs.arg-var-file }}${{ steps.arg.outputs.arg-var }}${{ steps.arg.outputs.arg-write }}${{ steps.arg.outputs.arg-auto-approve }}" | sed 's/ -/\n -/g' | grep "^ -${arg}" || "") done - echo "debug: 3" + command=$(echo "$command" | tr -d '\n')$command_append echo "command=$command" >> "$GITHUB_OUTPUT" From b116251d5609dccbb213e10df08c6eb66f0bdf62 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Fri, 8 Nov 2024 00:54:37 +0000 Subject: [PATCH 7/8] when in doubt, fallback on true Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index dadf54e7..e44ccbb3 100644 --- a/action.yml +++ b/action.yml @@ -278,7 +278,7 @@ runs: command_append="" IFS=',' read -ra show_args <<< "${{ inputs.show-args }}" for arg in "${show_args[@]}"; do - command_append+=$(echo "${{ steps.arg.outputs.arg-workspace }}${{ steps.arg.outputs.arg-backend-config }}${{ steps.arg.outputs.arg-backend }}${{ steps.arg.outputs.arg-backup }}${{ steps.arg.outputs.arg-check }}${{ steps.arg.outputs.arg-compact-warnings }}${{ steps.arg.outputs.arg-concise }}${{ steps.arg.outputs.arg-destroy }}${{ steps.arg.outputs.arg-detailed-exitcode }}${{ steps.arg.outputs.arg-diff }}${{ steps.arg.outputs.arg-force-copy }}${{ steps.arg.outputs.arg-from-module }}${{ steps.arg.outputs.arg-generate-config-out }}${{ steps.arg.outputs.arg-get }}${{ steps.arg.outputs.arg-list }}${{ steps.arg.outputs.arg-lock-timeout }}${{ steps.arg.outputs.arg-lock }}${{ steps.arg.outputs.arg-lockfile }}${{ steps.arg.outputs.arg-migrate-state }}${{ steps.arg.outputs.arg-no-tests }}${{ steps.arg.outputs.arg-or-create }}${{ steps.arg.outputs.arg-parallelism }}${{ steps.arg.outputs.arg-plugin-dir }}${{ steps.arg.outputs.arg-reconfigure }}${{ steps.arg.outputs.arg-recursive }}${{ steps.arg.outputs.arg-refresh-only }}${{ steps.arg.outputs.arg-refresh }}${{ steps.arg.outputs.arg-replace }}${{ steps.arg.outputs.arg-state-out }}${{ steps.arg.outputs.arg-state }}${{ steps.arg.outputs.arg-target }}${{ steps.arg.outputs.arg-test-directory }}${{ steps.arg.outputs.arg-upgrade }}${{ steps.arg.outputs.arg-var-file }}${{ steps.arg.outputs.arg-var }}${{ steps.arg.outputs.arg-write }}${{ steps.arg.outputs.arg-auto-approve }}" | sed 's/ -/\n -/g' | grep "^ -${arg}" || "") + command_append+=$(echo "${{ steps.arg.outputs.arg-workspace }}${{ steps.arg.outputs.arg-backend-config }}${{ steps.arg.outputs.arg-backend }}${{ steps.arg.outputs.arg-backup }}${{ steps.arg.outputs.arg-check }}${{ steps.arg.outputs.arg-compact-warnings }}${{ steps.arg.outputs.arg-concise }}${{ steps.arg.outputs.arg-destroy }}${{ steps.arg.outputs.arg-detailed-exitcode }}${{ steps.arg.outputs.arg-diff }}${{ steps.arg.outputs.arg-force-copy }}${{ steps.arg.outputs.arg-from-module }}${{ steps.arg.outputs.arg-generate-config-out }}${{ steps.arg.outputs.arg-get }}${{ steps.arg.outputs.arg-list }}${{ steps.arg.outputs.arg-lock-timeout }}${{ steps.arg.outputs.arg-lock }}${{ steps.arg.outputs.arg-lockfile }}${{ steps.arg.outputs.arg-migrate-state }}${{ steps.arg.outputs.arg-no-tests }}${{ steps.arg.outputs.arg-or-create }}${{ steps.arg.outputs.arg-parallelism }}${{ steps.arg.outputs.arg-plugin-dir }}${{ steps.arg.outputs.arg-reconfigure }}${{ steps.arg.outputs.arg-recursive }}${{ steps.arg.outputs.arg-refresh-only }}${{ steps.arg.outputs.arg-refresh }}${{ steps.arg.outputs.arg-replace }}${{ steps.arg.outputs.arg-state-out }}${{ steps.arg.outputs.arg-state }}${{ steps.arg.outputs.arg-target }}${{ steps.arg.outputs.arg-test-directory }}${{ steps.arg.outputs.arg-upgrade }}${{ steps.arg.outputs.arg-var-file }}${{ steps.arg.outputs.arg-var }}${{ steps.arg.outputs.arg-write }}${{ steps.arg.outputs.arg-auto-approve }}" | sed 's/ -/\n -/g' | grep "^ -${arg}" || true) done command=$(echo "$command" | tr -d '\n')$command_append From d29cc713b4d7db99bb132468c63faf37a95c51b4 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+rdhar@users.noreply.github.com> Date: Fri, 8 Nov 2024 00:56:50 +0000 Subject: [PATCH 8/8] restore tests with errors Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com> --- .github/workflows/tf_tests.yaml | 10 +++++----- action.yml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tf_tests.yaml b/.github/workflows/tf_tests.yaml index ddcb6630..3bc60d8f 100644 --- a/.github/workflows/tf_tests.yaml +++ b/.github/workflows/tf_tests.yaml @@ -21,10 +21,10 @@ jobs: matrix: test: - pass_one - # - pass_character_limit - # - fail_data_source_error - # - fail_format_diff - # - fail_invalid_resource_type + - pass_character_limit + - fail_data_source_error + - fail_format_diff + - fail_invalid_resource_type steps: - name: Echo context @@ -45,7 +45,7 @@ jobs: - name: Provision TF id: tf - # continue-on-error: true + continue-on-error: true uses: ./ with: command: ${{ github.event.pull_request.merged && 'apply' || 'plan' }} diff --git a/action.yml b/action.yml index e44ccbb3..30650bf7 100644 --- a/action.yml +++ b/action.yml @@ -271,7 +271,7 @@ runs: # Remove each comma-delemited hide-args argument from the command. IFS=',' read -ra hide_args <<< "${{ inputs.hide-args }}" for arg in "${hide_args[@]}"; do - command=$(echo "$command" | grep --invert-match "^ -${arg}") + command=$(echo "$command" | grep --invert-match "^ -${arg}" || true) done # Conversely, show each comma-delemited show-args argument in the command.