File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -124,16 +124,18 @@ jobs:
124124 ```bash
125125 DOCS_PR_URL=$(gh pr list --repo cloudflare/cloudflare-docs --head sync-docs-pr-${{ github.event.pull_request.number }} --json url --jq '.[0].url')
126126
127- # Check if bot comment already exists (look for comments from github-actions bot containing "Documentation sync" )
128- EXISTING_COMMENT_ID=$(gh pr view ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --json comments --jq '.comments [] | select(.author.login == "github-actions" and (. body | contains("Documentation sync") )) | .id' | head -1)
127+ # Check if bot comment already exists (look for unique marker in comment body )
128+ EXISTING_COMMENT_ID=$(gh api repos/ ${{ github.repository }}/issues/ ${{ github.event.pull_request.number }}/ comments --jq '.[] | select(.body | contains("<!-- docs- sync-comment -->" )) | .id' | head -1)
129129
130- COMMENT_BODY="📚 **Documentation sync PR:** $DOCS_PR_URL\n\n_This comment will be updated as the PR changes._"
130+ COMMENT_BODY="<!-- docs-sync-comment -->\n 📚 **Documentation sync PR:** $DOCS_PR_URL\n\n_This comment will be updated as the PR changes._"
131131
132132 if [ -n "$EXISTING_COMMENT_ID" ]; then
133133 # Edit existing comment
134+ echo "Updating existing comment ID: $EXISTING_COMMENT_ID"
134135 gh api --method PATCH /repos/${{ github.repository }}/issues/comments/$EXISTING_COMMENT_ID -f body="$COMMENT_BODY"
135136 else
136137 # Create new comment
138+ echo "Creating new comment"
137139 gh pr comment ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --body "$COMMENT_BODY"
138140 fi
139141 ```
You can’t perform that action at this time.
0 commit comments