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 23c711d745 - Show all commits

View file

@ -53,10 +53,6 @@ jobs:
run: tofu plan -no-color run: tofu plan -no-color
continue-on-error: true continue-on-error: true
- name: debug
run:
echo "${{ toJSON(forge) }}"
- name: Fetch existing comments - name: Fetch existing comments
id: fetch id: fetch
run: | run: |
@ -67,48 +63,43 @@ jobs:
comment_id=$(echo "$response" | jq -r \ comment_id=$(echo "$response" | jq -r \
'.[] | select(.body | test("OpenTofu Format and Style")) | .id' | head -n 1) '.[] | select(.body | test("OpenTofu Format and Style")) | .id' | head -n 1)
if [ -z $comment_id ]; then echo "$comment_id"
echo "Unable to fetch comment."
exit 1 - name: Upsert comment
id: comment
env:
COMMENT_BODY: |
`#### OpenTofu Format and Style 🖌\`${{ steps.fmt.outcome }}\`
#### OpenTofu Initialization ⚙️\`${{ steps.init.outcome }}\`
#### OpenTofu Validation 🤖\`${{ steps.validate.outcome }}\`
<details><summary>Validation Output</summary>
\`\`\`\n
${{ steps.validate.outputs.stdout }}
\`\`\`
</details>
#### OpenTofu Plan 📖\`${{ steps.plan.outcome }}\`
<details><summary>Show Plan</summary>
\`\`\`\n
${process.env.PLAN}
\`\`\`
</details>
run: |
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.comment_id }}" \
-d "{\"body\":\"$COMMENT_BODY\"}"
else
curl -s -X POST \
-H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}" \
-H "Content-Type: application/json" \
"${{ forge.api_url }}/repos/${{ forge.repository }}/issues/$PR_NUMBER/comments" \
-d "{\"body\":\"$COMMENT_BODY\"}"
fi fi
echo "comment_id=$comment_id"
# - name: Upsert comment
# id: comment
# env:
# COMMENT_BODY: |
# `#### OpenTofu Format and Style 🖌\`${{ steps.fmt.outcome }}\`
# #### OpenTofu Initialization ⚙️\`${{ steps.init.outcome }}\`
# #### OpenTofu Validation 🤖\`${{ steps.validate.outcome }}\`
# <details><summary>Validation Output</summary>
#
# \`\`\`\n
# ${{ steps.validate.outputs.stdout }}
# \`\`\`
#
# </details>
#
# #### OpenTofu Plan 📖\`${{ steps.plan.outcome }}\`
#
# <details><summary>Show Plan</summary>
#
# \`\`\`\n
# ${process.env.PLAN}
# \`\`\`
#
# </details>
# run: |
# 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.comment_id }}" \
# -d "{\"body\":\"$COMMENT_BODY\"}"
# else
# curl -s -X POST \
# -H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}" \
# -H "Content-Type: application/json" \
# "${{ forge.api_url }}/repos/${{ forge.repository }}/issues/$PR_NUMBER/comments" \
# -d "{\"body\":\"$COMMENT_BODY\"}"
# fi