diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..d439c69 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,31 @@ +name: Linting + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + + # This identifies which files changed in the specific commit or PR + - uses: tj-actions/changed-files@v47 + id: changed-files + with: + files: '**/*.md' + separator: "," + + # This runs the linter ONLY on the files identified above + - uses: DavidAnson/markdownlint-cli2-action@v22 + if: steps.changed-files.outputs.any_changed == 'true' + with: + globs: ${{ steps.changed-files.outputs.all_changed_files }} + separator: "," diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e4cff87..e2d467d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -177,7 +177,12 @@ chore: update mkdocs dependencies ### Linting -The project uses [markdownlint](https://github.com/DavidAnson/markdownlint) with configuration in `.markdownlint.json`. Key settings: +The project uses [markdownlint](https://github.com/DavidAnson/markdownlint) with configuration in `.markdownlint.json`. + +**Automated Checks:** +We have a GitHub Action that checks for formatting errors on Pull Requests. To follow best practices, **it only checks files that you have modified.** If the check fails, click the **Details** link next to the status check to view the error logs and see exactly what needs fixing. + +**Key Rules:** - 4-space indentation for lists (`MD007`). - No hard tab restrictions disabled. @@ -186,7 +191,8 @@ The project uses [markdownlint](https://github.com/DavidAnson/markdownlint) with - Allowed code blocks without language specification (`MD040`). - Allow fenced code blocks, as this commonly errors when indented (see [discussion](https://github.com/DavidAnson/markdownlint/issues/327)). -For faster PR review, you may want to run linting locally; we do have a PR Action in place as well. First install markdownlint, then run +**Local Testing** +For faster PR review, you may want to run linting locally. We recommend installing `markdownlint-cli` or the VS Code extension. ```console markdownlint -c .markdownlint.json -f docs/wiki-guide/