diff --git a/scripts/check_emdash.sh b/scripts/check_emdash.sh index 2b95fd4584..71d1728637 100755 --- a/scripts/check_emdash.sh +++ b/scripts/check_emdash.sh @@ -175,12 +175,19 @@ else exit 1 } if [[ -z "$base" ]]; then - echo "WARNING: no base ref found, scanning all tracked files." >&2 - scan_all_files - else - found=0 - scan_diff "$base" + # No base ref is available outside of pull requests, for + # example push builds on release branches with a shallow clone + # where neither GITHUB_BASE_REF nor origin/main is present. + # The diff check has nothing to compare against, and scanning + # every tracked file would flag pre-existing characters that + # are unrelated to the change under test. Skip instead; pass + # --all to force a full-tree scan. + echo "OK: no base ref found (not a pull request); skipping emdash check." + echo " Pass --all to scan every tracked file." + exit 0 fi + found=0 + scan_diff "$base" fi if [[ "$found" -ne 0 ]]; then