Skip to content

Commit 7ba5846

Browse files
committed
add check-occ-command workflow
Signed-off-by: Simon L. <[email protected]>
1 parent 495247a commit 7ba5846

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
if [ "$(grep "php occ" "$file" | grep -v "sudo -E -u www-data php occ" | wc -l)" -gt 0 ]; then
21+
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"
22+
echo "See $(grep "php occ" "$file" | grep -v "sudo -E -u www-data php occ")"
23+
FAIL=1
24+
fi
25+
done
26+
if [ -n "$FAIL" ]; then
27+
exit 1
28+
fi

0 commit comments

Comments
 (0)