Markdown check workflow #24
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Markdown Checks | |
on: | |
pull_request: | |
branches: | |
- main | |
permissions: | |
contents: read | |
pull-requests: write | |
jobs: | |
markdown_checks: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Install dependencies | |
run: | | |
npm install -g markdownlint-cli markdown-spellcheck markdown-link-check | |
- name: Run Markdown linter | |
if: always() | |
run: | | |
npx markdownlint '**/*.md' --config .markdownlint.yaml --ignore 'node_modules/**' 2>&1 | tee markdownlint.txt | |
if [ ${PIPESTATUS[0]} -ne 0 ]; then | |
title="Markdownlint Report" | |
comment="The following issues were found in the Markdown files. Please review and make the necessary changes." | |
header="## $title\n\n$comment\n\n" | |
body="```text\n$(cat markdownlint.txt)\n```" | |
gh pr comment ${{ github.event.pull_request.number }} -b "$header$body" | |
return 1 | |
fi | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Run spell checker | |
if: always() | |
run: | | |
npx markdown-spellcheck '**/*.md' --en-us -r -x -a 2>&1 | tee markdown-spellcheck.txt | |
if [ ${PIPESTATUS[0]} -ne 0 ]; then | |
gh pr comment ${{ github.event.pull_request.number }} -F markdown-spellcheck.txt | |
return 1 | |
fi | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Run link checker | |
if: always() | |
run: | | |
find . -name "*.md" -not -path "./node_modules/*" -not -path "./.github/*" -exec npx markdown-link-check -q {} + 2>&1 | tee markdown-link-check.txt | |
if [ -s markdown-link-check.txt ]; then | |
gh pr comment ${{ github.event.pull_request.number }} -F markdown-link-check.txt | |
return 1 | |
fi | |
env: | |
GH_TOKEN: ${{ github.token }} |