Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create workflow to lint Markdown files #265

Merged
merged 5 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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