Skip to content

Commit b10d3be

Browse files
EmersonFrasgithub-actions[bot]egrace479
authored
feat: Set up markdownlint GitHub Action for automated linting (Closes #14) (#42)
* Adds lint.yaml with linting instructions for changed MD files * Updates contributing.md with automated linting information * Instructions to check details for automated check fail * Update CONTRIBUTING.md to include lint URLs Co-authored-by: Elizabeth Campolongo <[email protected]> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Elizabeth Campolongo <[email protected]>
1 parent f5bab9d commit b10d3be

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

.github/workflows/lint.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Linting
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v6
16+
with:
17+
fetch-depth: 0
18+
19+
# This identifies which files changed in the specific commit or PR
20+
- uses: tj-actions/changed-files@v47
21+
id: changed-files
22+
with:
23+
files: '**/*.md'
24+
separator: ","
25+
26+
# This runs the linter ONLY on the files identified above
27+
- uses: DavidAnson/markdownlint-cli2-action@v22
28+
if: steps.changed-files.outputs.any_changed == 'true'
29+
with:
30+
globs: ${{ steps.changed-files.outputs.all_changed_files }}
31+
separator: ","

CONTRIBUTING.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,12 @@ chore: update mkdocs dependencies
177177

178178
### Linting
179179

180-
The project uses [markdownlint](https://github.com/DavidAnson/markdownlint) with configuration in `.markdownlint.json`. Key settings:
180+
The project uses [markdownlint](https://github.com/DavidAnson/markdownlint) with configuration in `.markdownlint.json`.
181+
182+
**Automated Checks:**
183+
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.
184+
185+
**Key Rules:**
181186

182187
- 4-space indentation for lists (`MD007`).
183188
- No hard tab restrictions disabled.
@@ -186,7 +191,8 @@ The project uses [markdownlint](https://github.com/DavidAnson/markdownlint) with
186191
- Allowed code blocks without language specification (`MD040`).
187192
- Allow fenced code blocks, as this commonly errors when indented (see [discussion](https://github.com/DavidAnson/markdownlint/issues/327)).
188193

189-
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
194+
**Local Testing**
195+
For faster PR review, you may want to run linting locally. We recommend installing [`markdownlint-cli`](https://github.com/igorshubovych/markdownlint-cli) or the [VS Code extension](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint).
190196

191197
```console
192198
markdownlint -c .markdownlint.json -f docs/wiki-guide/

0 commit comments

Comments
 (0)