PR number extraction and custom PR comment action.
Auto-PR Check/Creation and TF/OpenTofu Plan / Check and Create PR (push) Successful in 21s
Auto-PR Check/Creation and TF/OpenTofu Plan / Terraform/OpenTofu Plan (push) Failing after 46s

This commit is contained in:
2025-10-19 11:07:31 -04:00
parent 4ecb8c44ef
commit aa041c5e62
+48 -6
View File
@@ -9,6 +9,7 @@ on:
env:
OPENTOFU_VERSION: "1.10.6"
HC_VAULT_VERSION: "1.20.4"
TEA_VERSION: "0.10.1"
jobs:
check-and-create-pr:
@@ -64,6 +65,35 @@ jobs:
version: ${{ env.OPENTOFU_VERSION }}
tofu_wrapper: true
- name: Install Tea
id: install-tea-pr-index
env:
TEA_DL_URL: "https://dl.gitea.com/tea/${{ env.TEA_VERSION }}/tea-${{ env.TEA_VERSION }}-linux-amd64"
shell: bash
run: |
echo ${{ gitea.ref_name }}
cd /tmp
wget -q "${TEA_DL_URL}"
wget -q "${TEA_DL_URL}.sha256"
if $(sha256sum --quiet -c "tea-${{ inputs.tea-version }}-linux-amd64.sha256"); then
mv "tea-${{ inputs.tea-version }}-linux-amd64" /usr/bin/tea
chmod +x /usr/bin/tea
else
echo "WARNING ⛔: Tea v${{ inputs.tea-version }} Checksum Failed"
exit 1
fi
pr_number=$(tea pr ls --repo ${{ gitea.repository }} \
--state open \
--fields index,state,head \
--output simple \
| awk '{print $1}')
echo ${pr_number}
echo "pr_number=$pr_number" >> $GITHUB_OUTPUT
- name: Generate .env from Hashicorp Vault
uses: https://git.trez.wtf/Trez/hc-vault-env@main
with:
@@ -107,6 +137,7 @@ jobs:
- name: Tofu Plan
id: tofu_plan
continue-on-error: true
uses: dnogu/tofu-plan@v1
with:
working-directory: .
@@ -136,10 +167,21 @@ jobs:
# show-sensitive:
# display-plan:
- name: Tofu Plan Comment
id: tofu_plan
uses: alexnorell/tofu-pr-commenter@v2.0.0
- name: PR Comment
uses: https://git.trez.wtf/Trez.One/git-auto-comment@main
with:
commenter_type: plan
commenter_input: ${{ steps.tofu_plan.outputs.plan-output }}
commenter_exitcode: ${{ steps.tofu_plan.outputs.exitcode }}
platform: gitea
token: ${BOT_GITEA_TOKEN}
pr_index: $${{ steps.install-tea-pr-index.outputs.pr_number }}
comment_template: |
${{ steps.tofu_plan.outputs.plan-output }}
____________________________________
${{ steps.tofu_plan.outputs.exitcode }}
# - name: Tofu Plan Comment
# id: tofu_plan
# uses: alexnorell/tofu-pr-commenter@v2.0.0
# with:
# commenter_type: plan
# commenter_input: ${{ steps.tofu_plan.outputs.plan-output }}
# commenter_exitcode: ${{ steps.tofu_plan.outputs.exitcode }}