chore: Add tofu workflows #1

Merged
Peter merged 82 commits from pgi-add-workflows into main 2026-02-18 22:55:53 +01:00
Showing only changes of commit a7e100854a - Show all commits

View file

@ -1,5 +1,5 @@
---
name: tofu plan k8s-wheatley
name: Tofu Plan k8s-wheatley
on:
workflow_dispatch:
workflow_call:
@ -53,7 +53,7 @@ jobs:
run: tofu plan -no-color
continue-on-error: true
- name: Fetch existing comments
- name: Fetch existing comment ID
id: fetch
run: |
response=$(curl -s \
@ -61,7 +61,7 @@ jobs:
"${{ forge.api_url }}/repos/${{ forge.repository }}/issues/$PR_NUMBER/comments")
comment_id=$(echo "$response" | jq -r \
'.[] | select(.body | test("OpenTofu Format and Style")) | .id' | head -n 1)
'.[] | select(.body | test("${{ forge.workflow }}")) | .id' | head -n 1)
echo "comment_id=$comment_id"
@ -69,9 +69,12 @@ jobs:
id: comment
env:
COMMENT_BODY: |
#### OpenTofu Format and Style 🖌`${{ steps.fmt.outcome }}`
#### OpenTofu Initialization ⚙️`${{ steps.init.outcome }}`
#### OpenTofu Validation 🤖`${{ steps.validate.outcome }}`
### ${{ forge.workflow }}
${FMT_EMOJI} OpenTofu Format and Style `${{ steps.fmt.outcome }}`
${INIT_EMOJI} OpenTofu Initialization `${{ steps.init.outcome }}`
${VALIDATE_EMOJI} OpenTofu Validation `${{ steps.validate.outcome }}`
<details><summary>Validation Output</summary>
```
@ -90,6 +93,17 @@ jobs:
</details>
run: |
set -euo pipefail
emoji() {
[ "$1" = "success" ] && echo "✅" || echo "❌"
}
export FMT_EMOJI=$(emoji "$FMT_STATUS")
export INIT_EMOJI=$(emoji "$INIT_STATUS")
export VALIDATE_EMOJI=$(emoji "$VALIDATE_STATUS")
export PLAN_EMOJI=$(emoji "$PLAN_STATUS")
payload=$(jq -Rs --arg body "$COMMENT_BODY" '{body: $body}' <<< "$COMMENT_BODY")
if [ -n "${{ steps.fetch.outputs.comment_id }}" ] && [ "${{ steps.fetch.outputs.comment_id }}" != "null" ]; then