mirror of https://github.com/jetkvm/kvm.git
chore: update existing comment
This commit is contained in:
parent
566305549f
commit
2dafb5c9c1
|
@ -90,6 +90,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||||
TITLE="${{ github.event.pull_request.title }}"
|
TITLE="${{ github.event.pull_request.title }}"
|
||||||
|
PR_NUMBER=${{ github.event.pull_request.number }}
|
||||||
else
|
else
|
||||||
TITLE="main branch"
|
TITLE="main branch"
|
||||||
fi
|
fi
|
||||||
|
@ -105,4 +106,21 @@ jobs:
|
||||||
)
|
)
|
||||||
|
|
||||||
# Post Comment
|
# Post Comment
|
||||||
gh pr comment ${{ github.event.pull_request.number }} --body "$COMMENT"
|
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||||
|
# Look for an existing comment
|
||||||
|
COMMENT_ID=$(gh api repos/${{ github.repository }}/issues/$PR_NUMBER/comments \
|
||||||
|
--jq '.[] | select(.body | contains("✅ **Build successfully for")) | .id')
|
||||||
|
|
||||||
|
if [ -z "$COMMENT_ID" ]; then
|
||||||
|
# Create a new comment if none exists
|
||||||
|
gh pr comment $PR_NUMBER --body "$COMMENT"
|
||||||
|
else
|
||||||
|
# Update the existing comment
|
||||||
|
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID \
|
||||||
|
--method PATCH \
|
||||||
|
-f body="$COMMENT"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Log the comment for main branch
|
||||||
|
echo "$COMMENT"
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue