ci: setup docs prose linting with vale

- only deploy if prose lint passes
- rework styles download
- add vale anotations matcher
- set MinAlertLevel to warning
- add website pages to the prose linter
- do not fail on docs linting
This commit is contained in:
jo 2022-02-06 15:39:09 +01:00 committed by Jonas L
parent 2d644561bf
commit 75e3760f2e
9 changed files with 81 additions and 0 deletions

18
.github/annotations/vale.json vendored Normal file
View File

@ -0,0 +1,18 @@
{
"problemMatcher": [
{
"severity": "error",
"pattern": [
{
"regexp": "^([^:]+):(\\d+):(\\d+):([^:]+):(.*)$",
"file": 1,
"line": 2,
"column": 3,
"code": 4,
"message": 5
}
],
"owner": "vale-error"
}
]
}

4
.github/vale/styles/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*
!Makefile
!LibreTime
!Vocab

View File

@ -0,0 +1,6 @@
extends: substitution
message: Consider using '%s'
level: warning
ignorecase: false
swap:
Libretime: LibreTime

18
.github/vale/styles/Makefile vendored Normal file
View File

@ -0,0 +1,18 @@
.PHONY: all
SHELL = bash
%.zip:
wget -q $(URL) -O $@
Google.zip: URL=https://github.com/errata-ai/Google/releases/latest/download/Google.zip
Microsoft.zip: URL=https://github.com/errata-ai/Microsoft/releases/latest/download/Microsoft.zip
%: %.zip
unzip -qq $<
touch $@
STYLES := ./Microsoft ./Google
STYLES_ZIP := $(addsuffix .zip,$(STYLES))
all: $(STYLES)

View File

View File

View File

@ -10,12 +10,36 @@ on:
pull_request:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Vale
run: |
sudo pip3 install gh-release-install
sudo gh-release-install \
errata-ai/vale \
vale_{version}_Linux_64-bit.tar.gz --extract vale \
/usr/local/bin/vale
- name: Add annotations matchers
run: |
echo "::add-matcher::.github/annotations/vale.json"
- name: Run Vale
run: |
make -C .github/vale/styles
vale --output line docs website/src/pages || true
deploy:
name: Deploy
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
needs: [lint]
steps:
- uses: actions/checkout@v2

7
.vale.ini Normal file
View File

@ -0,0 +1,7 @@
StylesPath = .github/vale/styles
MinAlertLevel = warning
Vocab = Docs
[*.md]
BasedOnStyles = Vale, Google, Microsoft, LibreTime

View File

@ -37,3 +37,7 @@ tarball: VERSION
# Only clean subdirs
clean:
git clean -xdf */
docs-lint:
$(MAKE) -C .github/vale/styles
vale docs website/src/pages