chore: Add tofu workflows #1
1 changed files with 8 additions and 13 deletions
|
|
@ -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" \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue