-
Notifications
You must be signed in to change notification settings - Fork 42
49 lines (41 loc) · 1.39 KB
/
content-check.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
name: Content Compliance Check
on: [pull_request]
jobs:
content-compliance:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install dependencies
run: npm install
- name: File Naming and Folder Structure Compliance
run: |
files_invalid=false
for file in $(git diff --name-only origin/main...HEAD)
do
if [[ $file == articles/* || $file == guides/* ]]
then
if ! [[ $file =~ ^(articles|guides)/[0-9]{8}_[a-z0-9_]+\.md$ ]]
then
echo "Error: File \"$file\" does not follow the naming convention YYYYMMDD_title_of_the_article.md in 'articles' or 'guides' folder" >&2
files_invalid=true
fi
fi
if [[ $file == assets/* ]]
then
if ! [[ $file =~ ^assets/[0-9]{8}_[a-z0-9_]+_img[0-9]+\.png$ ]]
then
echo "Error: File \"$file\" does not follow the naming convention YYYYMMDD_title_of_the_article_imgN.png in 'assets' folder" >&2
files_invalid=true
fi
fi
done
if [ $files_invalid = true ]; then
exit 1
fi
- name: Run Markdown Lint
run: npx markdownlint '**/*.md --ignore "node_modules"'