Skip to content

Improve spellcheck script to allow for projects to specify additional sources #2503

Improve spellcheck script to allow for projects to specify additional sources

Improve spellcheck script to allow for projects to specify additional sources #2503

Workflow file for this run

name: Docs Linting
on:
workflow_call:
push:
branches: [develop, main]
pull_request:
branches: [develop, main]
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
lint-md:
name: "Markdown"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Fetch config
shell: sh
run: |
test -f .markdownlint.yaml && echo "Using local config file" || curl --silent --show-error --fail --location https://raw.github.com/ROCm/rocm-docs-core/${GITHUB_REF#refs/heads}/.markdownlint.yaml -O
- name: Use markdownlint-cli2
uses: DavidAnson/[email protected]
with:
globs: "**/*.md"
spelling:
name: "Spelling"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Fetch config
if: ${{ ! contains( github.repository, 'rocm-docs-core') }}
shell: sh
run: |
curl --silent --show-error --fail --location https://raw.github.com/ROCm/rocm-docs-core/${GITHUB_REF#refs/heads}/docs/yaml_merger.py -O
curl --silent --show-error --fail --location https://raw.github.com/ROCm/rocm-docs-core/${GITHUB_REF#refs/heads}/.spellcheck.yaml -O
curl --silent --show-error --fail --location https://raw.github.com/ROCm/rocm-docs-core/${GITHUB_REF#refs/heads}/.wordlist.txt >> .wordlist.txt
- name: Install python dependencies
run: pip install pyyaml
- name: Check local spelling file
id: check_local_spelling
run: |
if [ -f .spellcheck.local.yaml ]; then
echo "check_result=true" >> $GITHUB_OUTPUT
else
echo "check_result=false" >> $GITHUB_OUTPUT
fi
- name: Merge local and main YAML files
if: steps.check_local_spelling.outputs.check_result == 'true'
shell: sh
run: |
python3 docs/yaml_merger.py .spellcheck.yaml .spellcheck.local.yaml .spellcheck.yaml
- name: Run spellcheck
uses: rojopolis/spellcheck-github-actions@v0
- name: On fail
if: failure()
run: |
echo "Please check for spelling mistakes or add them to '.wordlist.txt' in either the root of this project or in rocm-docs-core."