-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (32 loc) · 997 Bytes
/
run-textlint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
name: run-textlint
on:
pull_request_target:
types: [opened, synchronize]
paths: ['docs/**/*.md']
jobs:
run-textlint:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install
- run: npx textlint ./docs//*.md -o ./.textlint.log | true
shell: bash {0}
- name: Report if textlint finds problems
run: |
if [ -e ./.textlint.log ]; then
# create body file
pwd_esc=$(pwd | sed 's/\//\\\//g')
cat ./.textlint.log | sed "s/${pwd_esc}/### :policeman: ./g" >> ./.body.txt
# pr comment
gh pr comment --body-file ./.body.txt "${URL}"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
URL: ${{ github.event.pull_request.html_url }}