Skip to content

Commit 50de3fd

Browse files
authored
Add: Commit checker to enforce 100 line length (#120)
1 parent 5a71df4 commit 50de3fd

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

.github/workflows/docs-checker.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Docs checker
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
paths:
7+
- 'docs/**'
8+
jobs:
9+
validate-line-length:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0
15+
- name: Make sure git is installed
16+
run: apt-get update && apt-get install git -y && git --version
17+
# "https://google.com/serch"
18+
19+
# The first grep filters out everything that has a link in it. The second filters anything
20+
# that is not an addition (prefixed by a single '+').
21+
- name: Get changed file names of files changed in PR
22+
run: git diff -U0 ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -P "^(?!.*(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])).*" | grep -P "^\+{1}(?!\+)" > diff_files.txt
23+
- name: Count line lengths in diff_files.txt
24+
run: "awk -F: 'BEGIN { if(length>100) { err = 1; exit; } } END {exit err}' diff_files.txt"

0 commit comments

Comments
 (0)