Skip to content

Commit

Permalink
Create workflow to lint Markdown files (robolectric#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
MGaetan89 authored Oct 29, 2024
1 parent b6b5ab9 commit 8883bc3
Show file tree
Hide file tree
Showing 15 changed files with 290 additions and 201 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/lint-markdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Lint Markdown"

on:
merge_group:
pull_request:
push:
branches: [ master ]

jobs:
lint_project:
name: "Lint Markdown"
runs-on: ubuntu-latest
permissions:
statuses: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Lint Markdown
uses: DavidAnson/markdownlint-cli2-action@v16
with:
config: ".markdownlint.jsonc"
globs: |
"docs/**/*.md"
"#docs/javadoc/**/*.md"
12 changes: 12 additions & 0 deletions .markdownlint.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.jsonc
{
// Line length: https://github.com/DavidAnson/markdownlint/blob/main/doc/md013.md
"MD013": {
"line_length": 120,
"heading_line_length": 120,
"code_block_line_length": 120,
"tables": false
},
// Code block style: https://github.com/DavidAnson/markdownlint/blob/main/doc/md046.md
"MD046": false
}
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ This repository contains the source of the documentation that lives at [robolect

Make sure that you are on the `master` branch, and that it is up to date before making any changes. This is the default branch, so Git should put you there automatically.

### Build the documentation locally

Before submitting a Pull Request, run the documentation locally to check that the content and layout are correct. The documentation is built using [MkDocs](https://www.mkdocs.org/).

To do so, make sure that you have [Python 3+ installed](https://www.python.org/downloads/), and then install the required dependencies by running:
Expand All @@ -20,6 +22,16 @@ Then you can execute the following command to access the documentation locally a
mkdocs serve --open
```

### Validate your Markdown files

If you modified any Markdown file, we recommend using [`DavidAnson/markdownlint-cli2`](https://github.com/DavidAnson/markdownlint-cli2) to ensure that the formatting rules are respected.

Once installed, you can run the command below to perform the check. Add the `--fix` option to fix issues that can be addressed automatically. The non-resolved issues will be printed in the console.

```bash
markdownlint-cli2 "docs/**/*.md" "#docs/javadoc/**/*.md" --config .markdownlint.jsonc
```

Once your Pull Request is merged, the documentation will be automatically built and deployed by GitHub Actions.

## Javadocs
Expand Down
Loading

0 comments on commit 8883bc3

Please sign in to comment.