move comment logic
All checks were successful
Tofu Plan k8s-wheatley / tofu-plan-k8s-wheatley (pull_request) Successful in 23s

This commit is contained in:
Peter 2026-02-18 21:49:36 +01:00
parent 90c7c56e65
commit 7af1430289
Signed by: Peter
SSH key fingerprint: SHA256:B5tYaxBExaDm74r1px9iVeZ6F/ZDiyiy9SbBqfZYrvg

View file

@ -53,18 +53,6 @@ jobs:
run: tofu plan -no-color
continue-on-error: true
- name: Fetch existing comment ID
id: fetch
run: |
response=$(curl -s \
-H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}" \
"${{ forge.api_url }}/repos/${{ forge.repository }}/issues/$PR_NUMBER/comments")
comment_id=$(echo "$response" | jq -r \
'.[] | select(.body | test("${{ forge.workflow }}")) | .id' | head -n 1)
echo "$comment_id"
- name: Add comment
id: comment
env:
@ -93,7 +81,14 @@ jobs:
run: |
payload=$(jq -Rs --arg body "$COMMENT_BODY" '{body: $body}' <<< "$COMMENT_BODY")
if [ -n "${{ steps.fetch.outputs }}" ] && [ "${{ steps.fetch.outputs }}" != "null" ]; then
existing_comment=$(curl -s \
-H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}" \
"${{ forge.api_url }}/repos/${{ forge.repository }}/issues/$PR_NUMBER/comments")
comment_id=$(echo "$existing_comment" | jq -r \
'.[] | select(.body | test("${{ forge.workflow }}")) | .id' | head -n 1)
if [ -n "${comment_id}" ] && [ "${comment_id}" != "null" ]; then
curl -s -X PATCH \
-H "Authorization: token ${{ secrets.FORGEJO_TOKEN }}" \
-H "Content-Type: application/json" \