generated from LizardByte/template-base
-
-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (55 loc) · 1.6 KB
/
ci.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
---
name: "CI"
on:
pull_request:
branches:
- master
types:
- opened
- synchronize
- reopened
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install markdownlint-cli
run: |
npm install -g markdownlint-cli
- name: Lint markdown files
run: |
markdownlint \
-f \
-o markdownlint_report.log \
--ignore-path .markdownlintignore \
'**/*.md'
- name: Print summary
if: failure()
run: |
echo "### Linting report:" >> $GITHUB_STEP_SUMMARY
cat markdownlint_report.log >> $GITHUB_STEP_SUMMARY
echo "### Suggested changes:" >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
echo "$(git diff)" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
- name: Additional checks
if: always()
run: |
exit_code=0
# check character count
for file in $(find ./docs -type f -name '*.md'); do
echo "Checking $file"
char_count=$(wc -c <"$file")
echo "Character count: $char_count"
filename=$(basename "$file")
echo "Filename: $filename"
if [[ $char_count -gt 4096 ]]; then
echo "$file exceeds the 4096 character limit" >> $GITHUB_STEP_SUMMARY
exit_code=1
fi
done
exit $exit_code