From 96394ab1b16479c92b6f2279367be86ea01b0721 Mon Sep 17 00:00:00 2001 From: Damien Date: Sun, 3 May 2026 21:07:27 +0200 Subject: [PATCH] Update Terraform workflow file paths and output handling - Change single quotes to double quotes in path filters for consistency - Modify command redirection to use > instead of | tee for cleaner output handling - Add explicit cat command to display plan output in logs - Standardize whitespace formatting throughout files --- .gitea/workflows/terraform-deploy.yml | 11 ++++++----- .gitea/workflows/terraform-pr.yml | 17 +++++++++-------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.gitea/workflows/terraform-deploy.yml b/.gitea/workflows/terraform-deploy.yml index d40a000..376f1a0 100644 --- a/.gitea/workflows/terraform-deploy.yml +++ b/.gitea/workflows/terraform-deploy.yml @@ -5,8 +5,8 @@ on: branches: - dev paths: - - 'terraform/**' - - '.gitea/workflows/terraform-*.yml' + - "terraform/**" + - ".gitea/workflows/terraform-*.yml" env: TF_WORKING_DIR: terraform/prod @@ -89,16 +89,17 @@ jobs: id: plan run: | set +e - terraform plan -input=false -no-color -detailed-exitcode -out=tfplan 2>&1 | tee plan_output.txt + terraform plan -input=false -no-color -detailed-exitcode -out=tfplan > plan_output.txt 2>&1 EXITCODE=$? - + cat plan_output.txt + # Determine if there are changes if [ $EXITCODE -eq 2 ]; then echo "has_changes=true" >> $GITHUB_OUTPUT else echo "has_changes=false" >> $GITHUB_OUTPUT fi - + # Exit 1 is error, 0 and 2 are OK if [ $EXITCODE -eq 1 ]; then exit 1 diff --git a/.gitea/workflows/terraform-pr.yml b/.gitea/workflows/terraform-pr.yml index 2d889cf..ccbb958 100644 --- a/.gitea/workflows/terraform-pr.yml +++ b/.gitea/workflows/terraform-pr.yml @@ -5,8 +5,8 @@ on: branches: - dev paths: - - 'terraform/**' - - '.gitea/workflows/terraform-*.yml' + - "terraform/**" + - ".gitea/workflows/terraform-*.yml" env: TF_WORKING_DIR: terraform/prod @@ -87,8 +87,9 @@ jobs: id: plan run: | set +e - terraform plan -input=false -no-color -detailed-exitcode -out=tfplan 2>&1 | tee plan_output.txt + terraform plan -input=false -no-color -detailed-exitcode -out=tfplan > plan_output.txt 2>&1 EXITCODE=$? + cat plan_output.txt echo "exitcode=${EXITCODE}" >> $GITHUB_OUTPUT if [ $EXITCODE -eq 1 ]; then exit 1 @@ -116,22 +117,22 @@ jobs: PLAN_OUTPUT=$(cat plan_output.txt | head -c 60000) COMMENT_BODY=$(cat < Click to expand plan output - + \`\`\`hcl ${PLAN_OUTPUT} \`\`\` - + EOF ) - + curl -s -X POST \ -H "Authorization: token ${GIT_TOKEN}" \ -H "Content-Type: application/json" \