revert
All checks were successful
Tofu Plan k8s-wheatley / tofu-plan-k8s-wheatley (pull_request) Successful in 22s

This commit is contained in:
Peter 2026-02-18 21:18:59 +01:00
parent a57ae93310
commit 23f7449205
Signed by: Peter
SSH key fingerprint: SHA256:B5tYaxBExaDm74r1px9iVeZ6F/ZDiyiy9SbBqfZYrvg

View file

@ -63,56 +63,41 @@ jobs:
comment_id=$(echo "$response" | jq -r \
'.[] | select(.body | test("${{ forge.workflow }}")) | .id' | head -n 1)
echo "$comment_id"
echo "comment_id=$comment_id"
- name: Add comment
id: comment
env:
COMMENT_BODY: |
### ${{forge.workflow}}
#### OpenTofu Format and Style 🖌`${{ steps.fmt.outcome }}`
#### OpenTofu Initialization ⚙️`${{ steps.init.outcome }}`
#### OpenTofu Validation 🤖`${{ steps.validate.outcome }}`
<details><summary>Validation Output</summary>
```
${{ steps.validate.outputs.stdout }}
```
</details>
#### OpenTofu Plan 📖`${{ steps.plan.outcome }}`
<details><summary>Show Plan</summary>
```
${{ steps.plan.outputs.stdout }}
```
</details>
run: |
set -euo pipefail
emoji() {
[ "$1" = success ] && echo "✅" || echo "❌"
}
FMT_OUTPUT="$(emoji ${{ steps.fmt.outcome }}) OpenTofu Format and Style"
INIT_OUTPUT="$(emoji ${{ steps.init.outcome }}) OpenTofu Initialization"
VALIDATE_OUTPUT="$(emoji ${{ steps.validate.outcome }}) OpenTofu Validation"
PLAN_OUTPUT="$(emoji ${{ steps.plan.outcome }}) OpenTofu Plan 📖"
COMMENT_BODY=$(cat <<EOF
### ${{ forge.workflow }}
${FMT_OUTPUT}
${INIT_OUTPUT}
${VALIDATE_OUTPUT}
<details><summary>Validation Output</summary>
```
${{ steps.validate.outputs.stdout }}
```
</details>
${PLAN_OUTPUT}
<details><summary>Show Plan</summary>
```
${{ steps.plan.outputs.stdout }}
```
</details>
EOF
)
payload=$(jq -Rs --arg body "$COMMENT_BODY" '{body: $body}' <<< "$COMMENT_BODY")
if [ -n "${{ steps.fetch.outputs }}" ] && [ "${{ steps.fetch.outputs }}" != "null" ]; then
if [ -n "${{ steps.fetch.outputs.comment_id }}" ] && [ "${{ steps.fetch.outputs.comment_id }}" != "null" ]; then
curl -s -X PATCH \
-H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}" \
-H "Content-Type: application/json" \
"${{ forge.api_url }}/repos/${{ forge.repository }}/issues/comments/${{ steps.fetch.outputs }}" \
"${{ forge.api_url }}/repos/${{ forge.repository }}/issues/comments/${{ steps.fetch.outputs.comment_id }}" \
-d "$payload"
else
curl -s -X POST \