Skip to content

Commit

Permalink
fix: plan output on error (#215)
Browse files Browse the repository at this point in the history
* fix plan output on error

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* debug print `process.env.tf_plan_outline`

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* debug print

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* debug print

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* debug print

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* explicit boolean check of `tf_plan_outline`

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

* clean up debug

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>

---------

Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>
  • Loading branch information
RDhar committed May 26, 2024
1 parent 85327f7 commit 5281cb5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ runs:
tf_fmt: ${{ steps.render.outputs.tf_fmt }}
tf_output: ${{ steps.render.outputs.tf_output }}
tf_plan_id: ${{ steps.arguments.outputs.tf_plan_id }}
tf_plan_outline: ${{ inputs.plan_outline && steps.plan.outcome == 'success' }}
tf_plan_outline: ${{ steps.plan.outputs.exitcode == 0 && inputs.plan_outline }}
with:
retries: 3
script: await require(`${process.env.GITHUB_ACTION_PATH}/scripts/comment_tf_output.js`)({ github, context, core, exec });
Expand Down
2 changes: 1 addition & 1 deletion scripts/comment_tf_output.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ${process.env.tf_fmt}

// Parse the TFplan file to extract an outline of changes.
let comment_outline = "";
if (process.env.tf_plan_outline) {
if (process.env.tf_plan_outline === "true") {
// Parse TFplan file.
let tfplan = "";
const data_handler = (data) => {
Expand Down

0 comments on commit 5281cb5

Please sign in to comment.