@@ -9,6 +9,9 @@ permissions:
99 pull-requests : write
1010 contents : read
1111
12+ env :
13+ comment-title : Markdown linter
14+
1215jobs :
1316 markdown-changed :
1417 runs-on : ubuntu-latest
2326 uses : tj-actions/changed-files@v45
2427 with :
2528 files : ' **/*.md'
29+ - name : Notify
30+ echo "::notice::Detected some changed markdown files"
2631
2732 lint-markdown :
2833 needs : markdown-changed
3944 uses : actions/checkout@v4
4045
4146 - name : Run markdown linter
42- if : steps.changed-markdown-files.outputs.any_changed == 'true'
4347 continue-on-error : true
4448 id : markdownlint
4549 uses : docker://avtodev/markdown-lint:v1
@@ -48,13 +52,25 @@ jobs:
4852 args : ' ${{ steps.changed-markdown-files.outputs.all_changed_files }}'
4953 output : ${{ env.lintreport }}
5054
55+ - name : Find previous PR comment
56+ uses : peter-evans/find-comment@v3
57+ id : findcomment
58+ with :
59+ issue-number : ${{ github.event.pull_request.number }}
60+ body-includes : ${{ env.comment-title }}
61+ direction : last
62+
5163 - name : Comment on success
5264 if : ${{ success() }}
5365 id : congrats
5466 uses : peter-evans/create-or-update-comment@v4
5567 with :
5668 issue-number : ${{ github.event.pull_request.number }}
69+ comment-id : ${{ steps.findcomment.outputs.comment-id }}
70+ reactions : hooray
71+ reactions-edit-mode : replace
5772 body : |
73+ ### ${{ env.comment-title }}
5874 Markdown looks good to me. Congrats!
5975
6076 - name : Check lint report exists
@@ -63,13 +79,12 @@ jobs:
6379 run : |
6480 echo "proceed=true" >> $GITHUB_OUTPUT
6581 echo "report=$(cat ${{ env.lintreport }})" >> $GITHUB_OUTPUT
82+ echo "::notice::Detected some linting issues with changed markdown"
6683
6784 pr-comment :
6885 needs : lint-markdown
6986 if : ${{ needs.lint-markdown.proceed == 'true' && needs.lint-markdown.report != '' }}
7087 runs-on : ubuntu-latest
71- env :
72- comment-title : Markdown linting issues detected in modified files
7388
7489 steps :
7590 - name : Format PR comment
8095 text=${{ steps.conveyor.outputs.report }}
8196 template-text : |
8297 ### ${{ env.comment-title }}
83- This check is advisory and is not blocking. Please adopt a nice markdown style.
98+ Some markdown linting issues were detected in modified .md files.
99+
100+ This check is advisory only and not blocking. Please adopt a nice markdown style.
84101
85- Markdown rules formatting rules are documented [here](https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md).
102+ Markdown formatting rules are documented [here](https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md).
86103
87104 {{ text }}
88105
@@ -91,12 +108,18 @@ jobs:
91108 id : findcomment
92109 with :
93110 issue-number : ${{ github.event.pull_request.number }}
94- body-includes : ${{ steps.conveyor.outputs.report }}
111+ body-includes : ${{ env.comment-title }}
95112 direction : last
96113
97114 - name : Create or update PR comment
98115 uses : peter-evans/create-or-update-comment@v4
99116 with :
100117 issue-number : ${{ github.event.pull_request.number }}
101118 comment-id : ${{ steps.findcomment.outputs.comment-id }}
119+ reactions : confused
120+ reactions-edit-mode : replace
102121 body : ${{ steps.commentformatter.outputs.updated-text }}
122+
123+ - name : Notify
124+ echo "::notice::Commented pull request ${{ github.event.pull_request.number }}"
125+ echo "::debug::${{ step.commentformatter.outputs.updated-text }}"
0 commit comments