Skip to content

Commit 186b444

Browse files
committed
add check-occ-command workflow
Signed-off-by: Simon L. <[email protected]>
1 parent 0dfbd84 commit 186b444

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Check occ command syntax
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**.rst'
7+
8+
jobs:
9+
check-occ-command:
10+
name: Check occ command syntax
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Run script
16+
run: |
17+
RST_FILE="$(find ./ -name '*.rst')"
18+
mapfile -t RST_FILE <<< "$RST_FILE"
19+
for file in "${RST_FILE[@]}"; do
20+
LINES="$(grep "php occ" "$file")"
21+
if [ -n "$LINES" ]; then
22+
LINES="$(echo "$LINES" | grep -v "sudo -E -u www-data php occ")"
23+
fi
24+
if [ "$(echo "$LINES" | wc -l)" -gt 0 ]; then
25+
printf "%b%s%b\n" "\e[0;31m" "$file does not use the 'sudo -E -u www-data php occ' syntax in some places which is required." "\e[0m"
26+
echo "See $LINES"
27+
FAIL=1
28+
fi
29+
done
30+
if [ -n "$FAIL" ]; then
31+
exit 1
32+
fi

0 commit comments

Comments
 (0)