This commit is contained in:
2025-11-03 09:41:33 -05:00
parent 3b03b8fb51
commit 30b9a8b677
+8 -14
View File
@@ -27,8 +27,7 @@ jobs:
fetch-depth: 1 fetch-depth: 1
- name: Setting Vault Token - name: Setting Vault Token
run: | run: echo "VAULT_TOKEN=${{ secrets.VAULT_GITEA_TOKEN }}" >> $GITHUB_ENV
echo "VAULT_TOKEN=${{ secrets.VAULT_GITEA_TOKEN }}" >> $GITHUB_ENV
- name: Gotify Notification - Start - name: Gotify Notification - Start
uses: eikendev/gotify-action@master uses: eikendev/gotify-action@master
@@ -87,19 +86,16 @@ jobs:
- name: Export env vars from Vault .env - name: Export env vars from Vault .env
id: env-vault-vars id: env-vault-vars
run: | run: |
echo "🧩 Cleaning and loading cloudflare/.env into GitHub Actions environment..." echo "🧩 Cleaning and loading cloudflare/.env..."
sed -i 's/[\"'\'']//g' cloudflare/.env sed -i 's/[\"'\'']//g' cloudflare/.env
set -a set -a
source cloudflare/.env source cloudflare/.env
set +a set +a
while IFS='=' read -r key value; do while IFS='=' read -r key value; do
if [[ -n "$key" ]]; then if [[ -n "$key" ]]; then
echo "$key=$value" >> $GITHUB_ENV echo "$key=$value" >> $GITHUB_ENV
fi fi
done < cloudflare/.env done < cloudflare/.env
repo_name=$(echo "${{ github.repository }}" | awk -F"/" '{print $2}') repo_name=$(echo "${{ github.repository }}" | awk -F"/" '{print $2}')
echo "repo_name=$repo_name" >> "$GITHUB_OUTPUT" echo "repo_name=$repo_name" >> "$GITHUB_OUTPUT"
@@ -118,14 +114,14 @@ jobs:
chdir: cloudflare chdir: cloudflare
out: cloudflare.tfplan out: cloudflare.tfplan
- name: Save plan output to file (with collapsible Markdown, ACT-safe) - name: Save raw plan output to file (ACT-safe)
run: | run: |
mkdir -p tmp mkdir -p tmp
# Save raw plan output first
echo "${{ steps.tofu_plan.outputs.plan-output }}" > tmp/tofu-plan-raw.txt echo "${{ steps.tofu_plan.outputs.plan-output }}" > tmp/tofu-plan-raw.txt
echo "Saved raw plan: tmp/tofu-plan-raw.txt ($(wc -c < tmp/tofu-plan-raw.txt) bytes)"
# Build Markdown file safely - name: Build Markdown PR comment (ACT-safe)
run: |
{ {
echo "## 🧩 OpenTofu Plan — Cloudflare" echo "## 🧩 OpenTofu Plan — Cloudflare"
echo "**Branch:** \`${{ github.ref_name }}\`" echo "**Branch:** \`${{ github.ref_name }}\`"
@@ -142,11 +138,9 @@ jobs:
echo "" echo ""
echo "*(This plan was automatically generated by the workflow.)*" echo "*(This plan was automatically generated by the workflow.)*"
} > tmp/tofu-plan.md } > tmp/tofu-plan.md
echo "Markdown PR comment built: tmp/tofu-plan.md"
echo "Plan file saved: tmp/tofu-plan.md ($(wc -c < tmp/tofu-plan.md) bytes)" - name: Comment full Tofu Plan on PR (Gitea safe)
- name: Comment full Tofu Plan on PR (safe)
uses: https://git.trez.wtf/Trez.One/git-auto-comment@main uses: https://git.trez.wtf/Trez.One/git-auto-comment@main
with: with:
platform: gitea platform: gitea