Update documentation and maintenance docs #15
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
########################################################################### | |
# # | |
# Copyright (c) Microsoft Corporation. All rights reserved. # | |
# # | |
# This code is licensed under the MIT License (MIT). # | |
# # | |
########################################################################### | |
name: Markdown Lint | |
on: | |
pull_request: | |
branches: | |
- main | |
- "releases/**" | |
paths: | |
- "docs/**" | |
- "README.md" | |
- en-US/**" | |
permissions: | |
contents: read | |
jobs: | |
markdown-check: | |
runs-on: windows-latest | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install npm dependencies | |
run: npm install -g markdown-link-check textlint textlint-rule-spelling dictionary-en textlint-filter-rule-comments | |
- name: Markdown link check | |
shell: pwsh | |
run: | | |
# Check all markdown files in the repository | |
$mlc_error_file = "link-errors.txt" | |
Remove-Item -Path $mlc_error_file -Recurse -Force -ErrorAction SilentlyContinue | |
Get-ChildItem -Path "README.md", ".\docs\" -Filter "*.md" -Recurse | ` | |
ForEach-Object { & markdown-link-check $_.FullName -q 2>>$mlc_error_file } | |
# Check if the error file exists | |
if (-not (Test-Path "$mlc_error_file")) { | |
return | |
} | |
# Check if the error file file contains errors | |
if (Select-String -Path "$mlc_error_file" -Pattern "ERROR: ") { | |
$errormsg = "Broken links found. Please check the output for more information." | |
$Link_Check_Summary = ":x: [Markdown Link Check] $errormsg" | |
echo $Link_Check_Summary >> $env:GITHUB_STEP_SUMMARY | |
throw $errormsg | |
} | |
else { | |
$Link_Check_Summary = ":white_check_mark: [Markdown Link Check] All links are valid." | |
echo $Link_Check_Summary >> $env:GITHUB_STEP_SUMMARY | |
} | |
- name: Markdown spell check | |
shell: pwsh | |
run: | | |
# Run spell check on all markdown files in the repository | |
$sc_error_file = "sc-errors.txt" | |
Remove-Item -Path $sc_error_file -Recurse -Force -ErrorAction SilentlyContinue | |
npx textlint README.md docs/**/*.md >>$sc_error_file | |
# Check if the error file exists | |
if (-not (Test-Path "$sc_error_file")) { | |
return | |
} | |
# Check if the error file file contains errors. If the file is empty, it means no errors were found. | |
if ([string]::IsNullOrWhiteSpace((Get-Content -Path $sc_error_file))) { | |
$Spell_Check_Summary = ":white_check_mark: [Markdown Spell Check] No spelling errors found." | |
} | |
else { | |
$Spell_Check_Summary = ":x: [Markdown Spell Check] Spelling errors found. Please check the output for more information." | |
cat $sc_error_file | |
} | |
echo $Spell_Check_Summary >> $env:GITHUB_STEP_SUMMARY |