From 5281cb5206934b50c196dbbd1654d78f953b9948 Mon Sep 17 00:00:00 2001 From: Rishav Dhar <19497993+RDhar@users.noreply.github.com> Date: Sun, 26 May 2024 21:07:45 +0100 Subject: [PATCH] fix: plan output on error (#215) * 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> --- action.yml | 2 +- scripts/comment_tf_output.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index f4ed867d..55defb32 100644 --- a/action.yml +++ b/action.yml @@ -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 }); diff --git a/scripts/comment_tf_output.js b/scripts/comment_tf_output.js index 1a65f6f2..fa42adc1 100644 --- a/scripts/comment_tf_output.js +++ b/scripts/comment_tf_output.js @@ -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) => {