Module: kamailio Branch: master Commit: e9852eff76091e1e7b2035d79ff083e760146011 URL: https://github.com/kamailio/kamailio/commit/e9852eff76091e1e7b2035d79ff083e7...
Author: Victor Seva linuxmaniac@torreviejawireless.org Committer: Victor Seva linuxmaniac@torreviejawireless.org Date: 2025-04-07T15:43:41+02:00
github: fix check-cmake-format.sh script [skip ci]
* add missing die/fail functions * missing actual checkout of review *before* checking the files * use '--config-files=' instead of '-c'. It was not checking anything
---
Modified: .github/scripts/check-cmake-format.sh
---
Diff: https://github.com/kamailio/kamailio/commit/e9852eff76091e1e7b2035d79ff083e7... Patch: https://github.com/kamailio/kamailio/commit/e9852eff76091e1e7b2035d79ff083e7...
---
diff --git a/.github/scripts/check-cmake-format.sh b/.github/scripts/check-cmake-format.sh index 582e0324714..a09d0fb8a5a 100755 --- a/.github/scripts/check-cmake-format.sh +++ b/.github/scripts/check-cmake-format.sh @@ -5,6 +5,9 @@ set -eu
res=0
+die() { echo "$@" >&2; exit 1; } +fail() { echo "*** $@ ***" >&2; res=1; } + git_log_format() { local pattern="$1" local reference="$2" @@ -17,8 +20,13 @@ check_cmake-format() { continue fi if [[ "${file}" =~ CMakeLists.txt$ ]] || [[ "${file}" =~ .cmake$ ]] ; then - echo "Checking ${file}" - cmake-format --check -c cmake/cmake-format.py "${file}" || res=1 + printf "Checking %s" "${file}" + if cmake-format --check --config-files=cmake/cmake-format.py "${file}" ; then + printf ". OK\n" + else + printf ". Fail\n" + res=1 + fi fi done < <(git diff-tree --no-commit-id --name-only -r "${1}") } @@ -46,6 +54,7 @@ echo "Checking $(git rev-list --count "${src_sha}" "^${target_sha}") commits sin for commit in $(git rev-list --reverse "${src_sha}" "^${target_sha}"); do commit_msg=$(git_log_format "${COMMIT_MESSAGE_SUBJECT_FORMAT}" "${commit}") echo "[${commit}] ${commit_msg}" + git checkout --progress --force "${commit}" check_cmake-format "${commit}" echo "===================== done ========= " done