@@ -296,11 +296,10 @@ jobs:
296
296
# Post initial comment with preview links
297
297
- name : Post initial preview comment
298
298
if : 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
300
300
with :
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 : |
304
303
# 📚 Documentation Preview ⏳
305
304
306
305
## 🖥️ [View Documentation Preview](https://coder.com/docs/@${{ steps.context-info.outputs.sanitized_branch }})
@@ -312,8 +311,8 @@ jobs:
312
311
- [Installation Guide](https://coder.com/docs/@${{ steps.context-info.outputs.sanitized_branch }}/install)
313
312
- [Quickstart](https://coder.com/docs/@${{ steps.context-info.outputs.sanitized_branch }}/tutorials/quickstart)
314
313
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
317
316
318
317
# Get changed files
319
318
- name : Get changed files
@@ -327,11 +326,10 @@ jobs:
327
326
# Update PR comment to show we're starting validation
328
327
- name : Update PR comment with in-progress status
329
328
if : 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
331
330
with :
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 : |
335
333
# 📚 Documentation Preview ⏳
336
334
337
335
## 🖥️ [View Documentation Preview](https://coder.com/docs/@${{ steps.context-info.outputs.sanitized_branch }})
@@ -343,7 +341,8 @@ jobs:
343
341
- [Installation Guide](https://coder.com/docs/@${{ steps.context-info.outputs.sanitized_branch }}/install)
344
342
- [Quickstart](https://coder.com/docs/@${{ steps.context-info.outputs.sanitized_branch }}/tutorials/quickstart)
345
343
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
347
346
348
347
# Run MegaLinter (documentation flavor)
349
348
- name : MegaLinter Documentation
@@ -623,14 +622,14 @@ jobs:
623
622
624
623
echo "::endgroup::"
625
624
626
- # Prepare comment for PR using a template file approach
625
+ # Prepare comment for PR
627
626
- name : Prepare PR comment
628
627
id : prepare-comment
629
628
if : inputs.post-comment == 'true' && (inputs.pr-number != '' || github.event.pull_request) && steps.changed-files.outputs.all_changed_files != ''
630
629
shell : bash
631
630
run : |
632
631
echo "::group::Preparing PR comment"
633
-
632
+
634
633
# Variables for template
635
634
SANITIZED_BRANCH="${{ steps.context-info.outputs.sanitized_branch }}"
636
635
PREVIEW_URL="https://coder.com/docs/@$SANITIZED_BRANCH"
@@ -641,57 +640,64 @@ jobs:
641
640
TOTAL="${{ steps.validation-results.outputs.validation_count }}"
642
641
DURATION="${{ steps.validation-duration.outputs.duration }}"
643
642
WORKFLOW_RUN="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
644
-
645
- # Create a temporary file
646
- TEMP_FILE=$(mktemp)
647
-
643
+
648
644
# Create header based on success
649
645
if [ "${{ steps.validation-results.outputs.overall_success }}" == "true" ]; then
650
- echo "# 📚 Documentation Preview ✅" > $TEMP_FILE
646
+ HEADER= "# 📚 Documentation Preview ✅"
651
647
EMOJI="✅"
652
648
else
653
- echo "# 📚 Documentation Preview ⚠️" > $TEMP_FILE
649
+ HEADER= "# 📚 Documentation Preview ⚠️"
654
650
EMOJI="⚠️"
655
651
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)
656
664
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
675
666
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
+
676
673
# Export content to GitHub output
677
674
echo "comment<<EOF" >> $GITHUB_OUTPUT
678
- cat $TEMP_FILE >> $GITHUB_OUTPUT
675
+ echo "$COMMENT" >> $GITHUB_OUTPUT
679
676
echo "EOF" >> $GITHUB_OUTPUT
680
-
681
- # Cleanup
682
- rm $TEMP_FILE
683
-
677
+
684
678
echo "::endgroup::"
685
679
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
+
686
691
# Update the PR comment with results
687
692
- name : Update PR comment with results
688
693
if : 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
690
695
with :
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' }}
695
701
696
702
# Fail the workflow if specified and there are errors
697
703
- name : Check for validation failure
0 commit comments