From 647b249d4e838b7cc6f9250a40c9729d280e5fb5 Mon Sep 17 00:00:00 2001
From: pgijsbertsen <117165507+pgijsbertsen@users.noreply.github.com>
Date: Wed, 18 Feb 2026 18:31:09 +0100
Subject: [PATCH] debug
---
.../workflows/tofu-plan-k8s-wheatley.yaml | 141 ++++++++----------
1 file changed, 60 insertions(+), 81 deletions(-)
diff --git a/.forgejo/workflows/tofu-plan-k8s-wheatley.yaml b/.forgejo/workflows/tofu-plan-k8s-wheatley.yaml
index 54eedd8..a90520a 100644
--- a/.forgejo/workflows/tofu-plan-k8s-wheatley.yaml
+++ b/.forgejo/workflows/tofu-plan-k8s-wheatley.yaml
@@ -53,85 +53,64 @@ jobs:
run: tofu plan -no-color
continue-on-error: true
- - name: Fetch existing comments
- id: fetch
- run: |
- set -euxo pipefail
+ - name: debug
+ run:
+ cat <<'EOF'
+ ${{ toJSON(forge) }}
+ EOF
- echo "PR_NUMBER: $PR_NUMBER"
- echo "Forgejo URL: ${{ forge.server_url }}"
- echo "Repo: ${{ forge.repository }}"
-
- url="${{ forge.server_url }}/api/v1/repos/${{ forge.repository }}/issues/$PR_NUMBER/comments"
-
- echo "Requesting: $url"
-
- response=$(curl -sS -w "\nHTTP_STATUS:%{http_code}\n" \
- -H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}" \
- "$url")
-
- http_status=$(echo "$response" | sed -n 's/HTTP_STATUS://p')
- body=$(echo "$response" | sed '/HTTP_STATUS:/d')
-
- echo "HTTP status: $http_status"
-
- if [ "$http_status" != "200" ]; then
- echo "Forgejo API call failed"
- exit 1
- fi
-
- echo "Parsing JSONβ¦"
-
- echo "$body" | jq .
-
- comment_id=$(echo "$body" | jq -r \
- '.[] | select(.body | test("OpenTofu Format and Style")) | .id' | head -n 1)
-
- echo "Matched comment_id: '$comment_id'"
-
- if [ -z "$comment_id" ] || [ "$comment_id" = "null" ]; then
- echo "No existing comment found matching marker"
- exit 1
- fi
-
- echo "Found comment id: $comment_id"
- echo "comment_id=$comment_id" >> "$GITHUB_OUTPUT"
-
- - 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 }}\`
- Validation Output
-
- \`\`\`\n
- ${{ steps.validate.outputs.stdout }}
- \`\`\`
-
-
-
- #### OpenTofu Plan π\`${{ steps.plan.outcome }}\`
-
- Show Plan
-
- \`\`\`\n
- ${process.env.PLAN}
- \`\`\`
-
-
- 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.server_url }}/api/v1/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.server_url }}/api/v1/repos/${{ forge.repository }}/issues/$PR_NUMBER/comments" \
- -d "{\"body\":\"$COMMENT_BODY\"}"
- fi
+ # - name: Fetch existing comments
+ # id: fetch
+ # run: |
+ # response=$(curl -s \
+ # -H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}" \
+ # "${{ forge.server_url }}/api/v1/repos/${{ forge.repository }}/issues/$PR_NUMBER/comments")
+ #
+ # comment_id=$(echo "$response" | jq -r \
+ # '.[] | select(.body | test("OpenTofu Format and Style")) | .id' | head -n 1)
+ #
+ # if [ -z $comment_id ]; then
+ # echo "Unable to fetch comment."
+ # exit 1
+ # 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 }}\`
+ # Validation Output
+ #
+ # \`\`\`\n
+ # ${{ steps.validate.outputs.stdout }}
+ # \`\`\`
+ #
+ #
+ #
+ # #### OpenTofu Plan π\`${{ steps.plan.outcome }}\`
+ #
+ # Show Plan
+ #
+ # \`\`\`\n
+ # ${process.env.PLAN}
+ # \`\`\`
+ #
+ #
+ # 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.server_url }}/api/v1/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.server_url }}/api/v1/repos/${{ forge.repository }}/issues/$PR_NUMBER/comments" \
+ # -d "{\"body\":\"$COMMENT_BODY\"}"
+ # fi