Skip to content

Commit

Permalink
feat: detect crossover links as a PR check (#2675)
Browse files Browse the repository at this point in the history
* feat: define crossover link validation rules and enable them with vale

* feat: run vale as a pull request check

* feat: add a linting rule for production links

* fix: swap order of prettier and vale, so that both of them run on every change

* oops: remove prettier changes frmo this PR

* docs: add descriptions to each of the vale rules
  • Loading branch information
pepopowitz authored Oct 3, 2023
1 parent 0958fb2 commit b6edc91
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/check-format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: check-format
on: [pull_request]

jobs:
check-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
- name: Install Dependencies
run: npm ci
- name: Verify format with Vale
uses: errata-ai/vale-action@reviewdog
with:
filter_mode: added
reporter: github-pr-review
7 changes: 7 additions & 0 deletions .vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
StylesPath = "styles/camunda"

[{docs,versioned_docs}/**/*.{md,mdx}]
BasedOnStyles = all, docsInstance

[{optimize,optimize_versioned_docs}/**/*.{md,mdx}]
BasedOnStyles = all, optimizeInstance
8 changes: 8 additions & 0 deletions styles/camunda/all/hrefProduction.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
extends: existence
message: "Improper link format: '%s'. Please use relative URLs."
level: warning
nonword: true
scope: raw
tokens:
# Captures anything that is hardcoded to our production URL.
- "\\[[^\\]]*\\]\\(https://docs.camunda.io/(optimize|docs)/[^\\)]*\\)"
8 changes: 8 additions & 0 deletions styles/camunda/docsInstance/hrefDocsToDocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
extends: existence
message: "Improper link format: '%s'. Please specify the file extension."
level: warning
nonword: true
scope: raw
tokens:
# Captures any markdown link that directs to a URL starting with `docs` and not ending with `.md` or `.mdx`.
- "\\[[^\\]]*\\]\\((\\.)?(\\/)?docs(?!.*(\\.md|\\.mdx))[^\\)]*\\)"
8 changes: 8 additions & 0 deletions styles/camunda/docsInstance/hrefDocsToOptimize.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
extends: existence
message: "Improper link format: '%s'. Please use the `$optimize$` token when crossing doc instances."
level: warning
nonword: true
scope: raw
tokens:
# Captures any markdown link that crosses over to the `optimize` instance without using `$optimize$`.
- "\\[[^\\]]*\\]\\(\\/optimize[^\\)]*\\)"
8 changes: 8 additions & 0 deletions styles/camunda/optimizeInstance/hrefOptimizeToDocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
extends: existence
message: "Improper link format: '%s'. Please use the `$docs$` token when crossing doc instances."
level: warning
nonword: true
scope: raw
tokens:
# Captures any markdown link that crosses over to the `docs` instance without using `$docs$`.
- "\\[[^\\]]*\\]\\(\\/docs[^\\)]*\\)"
8 changes: 8 additions & 0 deletions styles/camunda/optimizeInstance/hrefOptimizeToOptimize.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
extends: existence
message: "Improper link format: '%s'. Please specify the file extension."
level: warning
nonword: true
scope: raw
tokens:
# Captures any markdown link that directs to a URL starting with `optimize` and not ending with `.md` or `.mdx`.
- "\\[[^\\]]*\\]\\((\\.)?(\\/)?optimize(?!.*(\\.md|\\.mdx))[^\\)]*\\)"

0 comments on commit b6edc91

Please sign in to comment.