diff --git a/.forgejo/workflows/tofu-plan-k8s-wheatley.yaml b/.forgejo/workflows/tofu-plan-k8s-wheatley.yaml index fbc2abb..3d266fa 100644 --- a/.forgejo/workflows/tofu-plan-k8s-wheatley.yaml +++ b/.forgejo/workflows/tofu-plan-k8s-wheatley.yaml @@ -57,23 +57,23 @@ jobs: run: echo "${{ toJSON(forge) }}" - # - 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: Fetch existing comments + 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("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: @@ -103,12 +103,12 @@ jobs: # 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 }}" \ + # "${{ 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.server_url }}/api/v1/repos/${{ forge.repository }}/issues/$PR_NUMBER/comments" \ + # "${{ forge.api_url }}/repos/${{ forge.repository }}/issues/$PR_NUMBER/comments" \ # -d "{\"body\":\"$COMMENT_BODY\"}" # fi