From 7ba58461a3a11d64a9a76027b9fd6f56151d4915 Mon Sep 17 00:00:00 2001 From: "Simon L." Date: Tue, 29 Apr 2025 12:52:32 +0200 Subject: [PATCH] add check-occ-command workflow Signed-off-by: Simon L. --- .github/workflows/check-occ-command.yml | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/check-occ-command.yml diff --git a/.github/workflows/check-occ-command.yml b/.github/workflows/check-occ-command.yml new file mode 100644 index 000000000..ebc770050 --- /dev/null +++ b/.github/workflows/check-occ-command.yml @@ -0,0 +1,28 @@ +name: Check occ command syntax + +on: + pull_request: + paths: + - '**.rst' + +jobs: + check-occ-command: + name: Check occ command syntax + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Run script + run: | + RST_FILE="$(find ./ -name '*.rst')" + mapfile -t RST_FILE <<< "$RST_FILE" + for file in "${RST_FILE[@]}"; do + if [ "$(grep "php occ" "$file" | grep -v "sudo -E -u www-data php occ" | wc -l)" -gt 0 ]; then + 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" + echo "See $(grep "php occ" "$file" | grep -v "sudo -E -u www-data php occ")" + FAIL=1 + fi + done + if [ -n "$FAIL" ]; then + exit 1 + fi