From 43bb558ae9708adc5a39782f5c31b3a0b590dd7c Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 14 Jan 2024 15:00:01 +0100 Subject: [PATCH] Fix: pre-commit: Skip branch check in ci (+used sed in codespell exceptions generation) (#27499) * Use 'sed' instead of 'perl' (sed is more common) * Skip branch check in ci --- .github/workflows/pre-commit.yml | 2 +- dev/tools/codespell/addCodespellIgnores.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 9ade67aee82..1e117a515d6 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -31,7 +31,7 @@ jobs: - name: Run pre-commit hooks env: # SKIP is used by pre-commit to not execute certain hooks - SKIP: php-cs,php-cbf,trailing-whitespace,end-of-file-fixer + SKIP: no-commit-to-branch,php-cs,php-cbf,trailing-whitespace,end-of-file-fixer run: | set -o pipefail pre-commit gc diff --git a/dev/tools/codespell/addCodespellIgnores.sh b/dev/tools/codespell/addCodespellIgnores.sh index 0ed32973824..2aaa9eedb68 100755 --- a/dev/tools/codespell/addCodespellIgnores.sh +++ b/dev/tools/codespell/addCodespellIgnores.sh @@ -40,7 +40,7 @@ fi # - Run codespell; # - For each line, create a grep command to find the lines; # - Execute that command by evaluation -codespell . | perl -p -e 's@^(.*?):\d+:\s(\S+)\s.*@grep -P '"'"'\\b$2\\b'"'"' "$1" >> '"${codespell_ignore_file}"'@;' | \ +codespell . | sed -n -E 's@^([^:]+):[[:digit:]]+:[[:space:]](\S+)[[:space:]].*@grep -P '\''\\b\2\\b'\'' "\1" >> '"${codespell_ignore_file}"'@p' | \ while read -r line ; do eval "$line" ; done # Finally, sort and remove duplicates to make merges easier.