Skip to content

Commit

Permalink
Make the Vale prose linter required
Browse files Browse the repository at this point in the history
This change makes the prose linting step part of the required Lint
(Docs) job.

As of Vale 3.8.0, it is possible to set custom comment delimiters so an
author can temporarily disable a style rule within an MDX docs page. For
example, an author can ignore the `protocol-products` rule by including
this:

```text
{/* vale messaging.protocol-products = NO */}

This paragraph is about server access.

{/* vale messaging.protocol-products = YES */}
```

This change updates the version of Vale used by the linting job to
3.9.0, and includes custom comment delimiters in the configuration.
  • Loading branch information
ptgott committed Dec 2, 2024
1 parent c946cb1 commit d436555
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 22 deletions.
30 changes: 9 additions & 21 deletions .github/workflows/doc-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:

permissions:
contents: read
pull-requests: read

steps:
- name: Checkout
Expand Down Expand Up @@ -109,34 +110,21 @@ jobs:
working-directory: 'docs'
run: yarn markdown-lint

- name: Test the docs build
working-directory: docs
run: yarn build

stylecheck:
name: Lint docs prose style
runs-on: ubuntu-latest
needs: changes
if: ${{ !startsWith(github.head_ref, 'dependabot/') && needs.changes.outputs.changed == 'true' && github.event_name == 'pull_request' }}
permissions:
pull-requests: read
steps:
- name: Check out the teleport repo
uses: actions/checkout@v4
with:
repository: "gravitational/teleport"

- name: Run the linter
- name: Lint docs prose
uses: errata-ai/vale-action@d89dee975228ae261d22c15adcd03578634d429c # v2.1.1
with:
version: 2.30.0
version: 3.9.0
# Take the comma-separated list of files returned by the "Check for
# relevant changes" job.
separator: ","
separator: ','
workdir: '${{ github.workspace }}/docs/content/teleport'
files: ${{ needs.changes.outputs.changed_files }}
# Restrict the linter to lines modified/added by a PR, not entire
# changed files.
filter_mode: added
fail_on_error: true
vale_flags: "--config=docs/.vale.ini"
vale_flags: '--config=${{ github.workspace }}/docs/content/teleport/docs/.vale.ini'

- name: Test the docs build
working-directory: 'docs'
run: yarn build
1 change: 1 addition & 0 deletions docs/.vale.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ mdx = md

[*.md]
BasedOnStyles = messaging,examples,3rd-party-products,structure
CommentDelimiters = "{/*,*/}"
2 changes: 1 addition & 1 deletion docs/vale-styles/structure/step-numbering.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# such as the presence of step headings in how-to guides and the formatting of
# step headings.
extends: script
level: error
level: warning
message: Guides that include H2 sections named after numbered steps (e.g., "Step 1/5") must have the expected sequence of numbers and accurate total numbers of steps. This heading either has an unexpected step number or an unexpected total number of steps.
scope: raw
script: |
Expand Down

0 comments on commit d436555

Please sign in to comment.