-
Notifications
You must be signed in to change notification settings - Fork 644
79 lines (77 loc) · 2.53 KB
/
pr-checks.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: PR Checks
on:
pull_request:
jobs:
editorconfig:
name: Форматирование
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- id: files
if: ${{ github.event_name == 'pull_request' }}
uses: Ana06/[email protected]
- name: Работает линтер
run: |
npm install editorconfig-checker --global
config=.editorconfig
for changed_file in ${{ steps.files.outputs.added_modified }}; do
if [ $changed_file == $config ]
then
echo "Проверка для всех файлов"
editorconfig-checker
break
else
echo "Проверка для ${changed_file}"
editorconfig-checker ${changed_file}
fi
done
frontmatter-checker:
name: Мета
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- id: files
if: ${{ github.event_name == 'pull_request' }}
uses: Ana06/[email protected]
with:
filter: |
(css|html|js|tools|a11y)/**/index.md
!(pages|people)/**/index.md
- name: Работает линтер
run: |
files='${{ steps.files.outputs.added_modified }}'
if ! [[ $files == "" ]]; then
echo "Проверка для файлов из PR"
npx yaml-cat --format json --output result.json $(echo $files | grep -o -E '(css|html|js|tools|a11y)/[a-z-]+/index.md')
node .github/scripts/frontmatter.js
else
echo "В PR нет файлов для проверки"
fi
link-checker:
name: Ссылки
needs:
- editorconfig
- frontmatter-checker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: files
if: ${{ github.event_name == 'pull_request' }}
uses: Ana06/[email protected]
with:
filter: '*.md'
format: 'csv'
- name: Проверяет ссылки
if: ${{ steps.files.outputs.added_modified != '' }}
uses: JustinBeckwith/linkinator-action@v1
with:
paths: ${{ steps.files.outputs.added_modified }}
markdown: true
serverRoot: "/home/runner/work/content/content"
linksToSkip: "https?://(localhost|codepen.io)?(:[0-9]+)?/.*"