8484 fi
8585
8686 -name :Post initial comment
87- id :post-comment
8887env :
8988GH_TOKEN :${{ github.token }}
9089PR_NUMBER :${{ steps.determine-inputs.outputs.pr_number }}
9998 [View workflow run](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${RUN_ID})
10099 EOF
101100 )
102- COMMENT_ID=$(gh pr comment "${PR_NUMBER}" --body "${COMMENT_BODY}" --repo "${GITHUB_REPOSITORY}" | grep -oP 'https://github.com/.*/pull/.*#issuecomment-\K\d+')
103- echo "comment_id=${COMMENT_ID}" >> "${GITHUB_OUTPUT}"
101+ gh pr comment "${PR_NUMBER}" --body "${COMMENT_BODY}" --repo "${GITHUB_REPOSITORY}" --create-if-none --edit-last
104102
105103 -name :Download and install Coder binary
106104shell :bash
@@ -225,15 +223,17 @@ jobs:
225223 -name :Update comment with task link
226224env :
227225GH_TOKEN :${{ github.token }}
228- COMMENT_ID :${{ steps.post-comment .outputs.comment_id }}
226+ PR_NUMBER :${{ steps.determine-inputs .outputs.pr_number }}
229227GITHUB_REPOSITORY :${{ github.repository }}
230228TASK_NAME :${{ steps.create-task.outputs.TASK_NAME }}
229+ RUN_ID :${{ github.run_id }}
231230run :|
232- # Fetch the original comment
233- ORIGINAL_COMMENT=$(gh api "/repos/${GITHUB_REPOSITORY}/issues/comments/${COMMENT_ID}" --jq '.body')
234-
235231 COMMENT_BODY=$(cat <<EOF
236- ${ORIGINAL_COMMENT}
232+ 🤖 **Documentation Check Started**
233+
234+ Analyzing PR changes to determine if documentation updates are needed...
235+
236+ [View workflow run](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${RUN_ID})
237237
238238 ---
239239
@@ -243,11 +243,7 @@ jobs:
243243 EOF
244244 )
245245
246- # Update the comment with task link
247- gh api \
248- --method PATCH \
249- "/repos/${GITHUB_REPOSITORY}/issues/comments/${COMMENT_ID}" \
250- -f body="${COMMENT_BODY}"
246+ gh pr comment "${PR_NUMBER}" --body "${COMMENT_BODY}" --repo "${GITHUB_REPOSITORY}" --edit-last
251247
252248 -name :Wait for task completion and get results
253249id :get-results
@@ -286,18 +282,18 @@ jobs:
286282GH_TOKEN :${{ github.token }}
287283PR_NUMBER :${{ steps.determine-inputs.outputs.pr_number }}
288284GITHUB_REPOSITORY :${{ github.repository }}
289- COMMENT_ID :${{ steps.post-comment.outputs.comment_id }}
290285TASK_NAME :${{ steps.create-task.outputs.TASK_NAME }}
291286RUN_ID :${{ github.run_id }}
292287run :|
293288 TASK_OUTPUT=$(cat /tmp/task_output.txt)
294289 DURATION=$(cat /tmp/task_duration.txt)
295290
296- # Fetch the original comment to preserve it
297- ORIGINAL_COMMENT=$(gh api "/repos/${GITHUB_REPOSITORY}/issues/comments/${COMMENT_ID}" --jq '.body')
298-
299291 COMMENT_BODY=$(cat <<EOF
300- ${ORIGINAL_COMMENT}
292+ 🤖 **Documentation Check Started**
293+
294+ Analyzing PR changes to determine if documentation updates are needed...
295+
296+ [View workflow run](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${RUN_ID})
301297
302298 ---
303299
@@ -310,9 +306,5 @@ jobs:
310306 EOF
311307 )
312308
313- # Update the existing comment
314- gh api \
315- --method PATCH \
316- "/repos/${GITHUB_REPOSITORY}/issues/comments/${COMMENT_ID}" \
317- -f body="${COMMENT_BODY}"
309+ gh pr comment "${PR_NUMBER}" --body "${COMMENT_BODY}" --repo "${GITHUB_REPOSITORY}" --edit-last
318310