Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit e3f0e1f

Browse files
authored
Merge 25da042 into 5f19480
2 parents 5f19480 + 25da042 commit e3f0e1f

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/workflows/pull_request.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,59 @@ jobs:
115115
git commit -m 'Style *mds' || echo "No changes to commit"
116116
git push origin || echo "No changes to commit"
117117
118+
############################# Check Markdown Formatting ###################################
119+
markdown-linter:
120+
name: Markdown linter
121+
needs: yaml-check
122+
runs-on: ubuntu-latest
123+
if: ${{needs.yaml-check.outputs.toggle_md_linter == 'yes'}}
124+
125+
steps:
126+
- name: Checkout files
127+
uses: actions/checkout@v4
128+
129+
- uses: DavidAnson/markdownlint-cli2-action@v19
130+
with:
131+
globs: '**/*.md'
132+
continue-on-error: true
133+
134+
- name: Find Comment
135+
uses: peter-evans/find-comment@v2
136+
id: fc
137+
with:
138+
issue-number: ${{ github.event.pull_request.number }}
139+
comment-author: 'github-actions[bot]'
140+
body-includes: Markdown linter
141+
142+
- name: Get Job ID from GH API
143+
id: get-job-id
144+
env:
145+
GH_TOKEN: ${{ secrets.GH_PAT }}
146+
run: |
147+
jobs=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id}}/attempts/${{ github.run_attempt }}/jobs)
148+
job_id=$(echo $jobs | jq -r '.jobs[] | select(.runner_name=="${{ runner.name }}") | .id')
149+
echo $job_id
150+
echo "job_id=$job_id" >> $GITHUB_OUTPUT
151+
152+
- name: Build components of the comment
153+
id: build-components
154+
run: |
155+
report_link=$(echo "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ steps.get-job-id.outputs.job_id }}")
156+
echo $report_link
157+
echo "time=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
158+
echo "commit_id=$GITHUB_SHA" >> $GITHUB_OUTPUT
159+
echo ${{steps.commit.outputs.markdown_issues}}
160+
161+
- name: Create or uxpdate comment
162+
uses: peter-evans/create-or-update-comment@v2
163+
with:
164+
comment-id: ${{ steps.fc.outputs.comment-id }}
165+
issue-number: ${{ github.event.pull_request.number }}
166+
body: |
167+
[Markdown linter report here](${{ steps.build-components.outputs.report_link }})
168+
_Updated at ${{ steps.build-components.outputs.time }} with changes from the latest commit ${{ steps.build-components.outputs.commit_id }}_
169+
edit-mode: replace
170+
118171
############################# Readability Report ###################################
119172

120173
readability-report:

0 commit comments

Comments
 (0)