@@ -296,11 +296,10 @@ jobs:
296296# Post initial comment with preview links
297297 -name :Post initial preview comment
298298if :inputs.post-comment == 'true' && inputs.generate-preview == 'true' && (inputs.pr-number != '' || github.event.pull_request)
299- uses :marocchino/sticky-pull-request -comment@v2.9.2
299+ uses :peter-evans/create-or-update -comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
300300with :
301- header :docs-preview-comment
302- number :${{ inputs.pr-number || github.event.pull_request.number }}
303- message :|
301+ issue-number :${{ inputs.pr-number || github.event.pull_request.number }}
302+ body :|
304303 # 📚 Documentation Preview ⏳
305304
306305 ## 🖥️ [View Documentation Preview](https://coder.com/docs/@${{ steps.context-info.outputs.sanitized_branch }})
@@ -312,8 +311,8 @@ jobs:
312311 - [Installation Guide](https://coder.com/docs/@${{ steps.context-info.outputs.sanitized_branch }}/install)
313312 - [Quickstart](https://coder.com/docs/@${{ steps.context-info.outputs.sanitized_branch }}/tutorials/quickstart)
314313
315- <sub>⏳Validating documentation ... (Started at $(TZ=UTC date '+%Y-%m-%d %H:%M:%S UTC')) </sub>
316- <sub>⏱️ Status update: Waiting for validation results - last update: $(TZ=UTC date '+%Y-%m-%d %H:%M:%S UTC')</sub>
314+ <sub>⏳Waiting for validation results ...</sub>
315+ reactions : eyes
317316
318317# Get changed files
319318 -name :Get changed files
@@ -327,11 +326,10 @@ jobs:
327326# Update PR comment to show we're starting validation
328327 -name :Update PR comment with in-progress status
329328if :inputs.post-comment == 'true' && (inputs.pr-number != '' || github.event.pull_request) && steps.changed-files.outputs.all_changed_files != ''
330- uses :marocchino/sticky-pull-request -comment@v2.9.2
329+ uses :peter-evans/create-or-update -comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
331330with :
332- header :docs-preview-comment
333- number :${{ inputs.pr-number || github.event.pull_request.number }}
334- message :|
331+ issue-number :${{ inputs.pr-number || github.event.pull_request.number }}
332+ body :|
335333 # 📚 Documentation Preview ⏳
336334
337335 ## 🖥️ [View Documentation Preview](https://coder.com/docs/@${{ steps.context-info.outputs.sanitized_branch }})
@@ -343,7 +341,8 @@ jobs:
343341 - [Installation Guide](https://coder.com/docs/@${{ steps.context-info.outputs.sanitized_branch }}/install)
344342 - [Quickstart](https://coder.com/docs/@${{ steps.context-info.outputs.sanitized_branch }}/tutorials/quickstart)
345343
346- <sub>⏳ Found ${{ steps.changed-files.outputs.all_changed_files_count }} markdown files to validate. Starting validation at $(TZ=UTC date '+%Y-%m-%d %H:%M:%S UTC')...</sub>
344+ <sub>⏳ Found ${{ steps.changed-files.outputs.all_changed_files_count }} markdown files. Validating documentation...</sub>
345+ reactions :eyes
347346
348347# Run MegaLinter (documentation flavor)
349348 -name :MegaLinter Documentation
@@ -623,14 +622,14 @@ jobs:
623622
624623 echo "::endgroup::"
625624
626- # Prepare comment for PR using a template file approach
625+ # Prepare comment for PR
627626 -name :Prepare PR comment
628627id :prepare-comment
629628if :inputs.post-comment == 'true' && (inputs.pr-number != '' || github.event.pull_request) && steps.changed-files.outputs.all_changed_files != ''
630629shell :bash
631630run :|
632631 echo "::group::Preparing PR comment"
633-
632+
634633 # Variables for template
635634 SANITIZED_BRANCH="${{ steps.context-info.outputs.sanitized_branch }}"
636635 PREVIEW_URL="https://coder.com/docs/@$SANITIZED_BRANCH"
@@ -641,57 +640,64 @@ jobs:
641640 TOTAL="${{ steps.validation-results.outputs.validation_count }}"
642641 DURATION="${{ steps.validation-duration.outputs.duration }}"
643642 WORKFLOW_RUN="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
644-
645- # Create a temporary file
646- TEMP_FILE=$(mktemp)
647-
643+
648644 # Create header based on success
649645 if [ "${{ steps.validation-results.outputs.overall_success }}" == "true" ]; then
650- echo "# 📚 Documentation Preview ✅" > $TEMP_FILE
646+ HEADER= "# 📚 Documentation Preview ✅"
651647 EMOJI="✅"
652648 else
653- echo "# 📚 Documentation Preview ⚠️" > $TEMP_FILE
649+ HEADER= "# 📚 Documentation Preview ⚠️"
654650 EMOJI="⚠️"
655651 fi
652+
653+ # Create comment content
654+ COMMENT="$HEADER
655+
656+ # # 🖥️ [View Documentation Preview]($PREVIEW_URL)
657+
658+ > $EMOJI **Validation Result**: $BADGE
659+
660+ # ## Quick Links
661+ -[Main Docs]($PREVIEW_URL)
662+ -[Installation Guide]($PREVIEW_URL/install)
663+ -[Quickstart]($PREVIEW_URL/tutorials/quickstart)
656664
657- # Add content line by line
658- echo "" >> $TEMP_FILE
659- echo "## 🖥️ [View Documentation Preview]($PREVIEW_URL)" >> $TEMP_FILE
660- echo "" >> $TEMP_FILE
661- echo "> $EMOJI **Validation Result**: $BADGE" >> $TEMP_FILE
662- echo "" >> $TEMP_FILE
663- echo "### Quick Links" >> $TEMP_FILE
664- echo "- [Main Docs]($PREVIEW_URL)" >> $TEMP_FILE
665- echo "- [Installation Guide]($PREVIEW_URL/install)" >> $TEMP_FILE
666- echo "- [Quickstart]($PREVIEW_URL/tutorials/quickstart)" >> $TEMP_FILE
667- echo "" >> $TEMP_FILE
668- echo "### 📊 Validation Stats" >> $TEMP_FILE
669- echo "" >> $TEMP_FILE
670- echo "- **Changed Files**: $FILES files checked" >> $TEMP_FILE
671- echo "- **Validation Success**: $SUCCESS% ($PASSING/$TOTAL checks passed)" >> $TEMP_FILE
672- echo "- **Processing Time**: $DURATION" >> $TEMP_FILE
673- echo "" >> $TEMP_FILE
674- echo "<sub>⏱️ Validation completed in $DURATION | Completed at $(TZ=UTC date '+%Y-%m-%d %H:%M:%S UTC') | [View Workflow Run]($WORKFLOW_RUN)</sub>" >> $TEMP_FILE
665+ # ## 📊 Validation Stats
675666
667+ - **Changed Files**: $FILES files checked
668+ - **Validation Success**: $SUCCESS% ($PASSING/$TOTAL checks passed)
669+ - **Processing Time**: $DURATION
670+
671+ <sub>⏱️ Validation completed in $DURATION | [View Workflow Run]($WORKFLOW_RUN)</sub>"
672+
676673# Export content to GitHub output
677674echo "comment<<EOF" >> $GITHUB_OUTPUT
678- cat $TEMP_FILE >> $GITHUB_OUTPUT
675+ echo "$COMMENT" >> $GITHUB_OUTPUT
679676echo "EOF" >> $GITHUB_OUTPUT
680-
681- # Cleanup
682- rm $TEMP_FILE
683-
677+
684678echo "::endgroup::"
685679
680+ # Find existing comment
681+ -name :Find existing comment
682+ if :inputs.post-comment == 'true' && (inputs.pr-number != '' || github.event.pull_request) && steps.changed-files.outputs.all_changed_files != ''
683+ uses :peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
684+ id :find-comment
685+ with :
686+ issue-number :${{ inputs.pr-number || github.event.pull_request.number }}
687+ comment-author :" github-actions[bot]"
688+ body-includes :" Documentation Preview"
689+ direction :last
690+
686691# Update the PR comment with results
687692 -name :Update PR comment with results
688693if :inputs.post-comment == 'true' && (inputs.pr-number != '' || github.event.pull_request) && steps.changed-files.outputs.all_changed_files != ''
689- uses :marocchino/sticky-pull-request -comment@v2.9.2
694+ uses :peter-evans/create-or-update -comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
690695with :
691- header :docs-preview-comment
692- number :${{ inputs.pr-number || github.event.pull_request.number }}
693- message :${{ steps.prepare-comment.outputs.comment }}
694- recreate :true
696+ comment-id :${{ steps.find-comment.outputs.comment-id }}
697+ issue-number :${{ inputs.pr-number || github.event.pull_request.number }}
698+ body :${{ steps.prepare-comment.outputs.comment }}
699+ edit-mode :replace
700+ reactions :${{ steps.validation-results.outputs.overall_success == 'true' && 'rocket' || 'eyes' }}
695701
696702# Fail the workflow if specified and there are errors
697703 -name :Check for validation failure