From 0000b684ca86b8422d7945ae9c719f17ee501e57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=97=D0=B0=D1=80=D1=83=D0=B1=D0=B8=D0=BD=20=D0=A4=D0=B8?= =?UTF-8?q?=D0=BB=D0=B8=D0=BF=D0=BF?= <289370046+zarubinphil@users.noreply.github.com> Date: Tue, 23 Jun 2026 22:02:49 +0300 Subject: [PATCH] fix: scope email check to branch-new commits, not full repo history MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git log --full-history in CI sees the merge commit's both parents — the main-branch parent carries old personal-email commits from before the noreply migration, causing a false positive. Fix: detect merge commit (HEAD^2 = PR tip, HEAD^1 = main tip) and use HEAD^1..HEAD^2 range; fall back to merge-base..HEAD locally. Also set fetch-depth: 0 in CI so merge-base is available. --- .github/workflows/smoke.yml | 2 ++ smoke/smoke.sh | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index 3c10b5d..0c0533e 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -12,6 +12,8 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 # нужен для merge-base в email-check - name: shellcheck (lint) run: | diff --git a/smoke/smoke.sh b/smoke/smoke.sh index 39c4e63..1d2cd32 100755 --- a/smoke/smoke.sh +++ b/smoke/smoke.sh @@ -31,8 +31,17 @@ echo "[личное] нет имён/usernames/приватных идентиф # shellcheck disable=SC2034 # используется через eval в chk (строка 31) PERSONAL_RE='(Philipp|Filipp|Zarubin(?!phil)|Филипп|Кирилов|Ломоносов|Менделеев|Калачов|com\.zarubin|7teenno1)' chk "нет личных данных в публичных tracked-файлах" "! git -C '$HERE' grep -IPni -e \"\$PERSONAL_RE\" -- ':!smoke/smoke.sh' ':!docs/audit-2026-06-16/**' >/dev/null 2>&1" -# Email автора в истории = PII вне file-grep. Разрешён только GitHub noreply. -chk "нет личных email в авторах коммитов" "! git -C '$HERE' log --format='%ae %ce' | tr ' ' '\n' | grep -vE '(noreply|^\$)' | grep -q ." +# Email автора = PII. Проверяем только коммиты ветки/PR, не всю историю репо. +# CI checkout refs/pull/N/merge → HEAD = merge commit, HEAD^2 = PR tip, HEAD^1 = main tip. +if _ec_p2=$(git -C "$HERE" rev-parse HEAD^2 2>/dev/null) && [ -n "$_ec_p2" ]; then + _ec_range="HEAD^1..$_ec_p2" +elif _ec_base=$(git -C "$HERE" merge-base HEAD origin/main 2>/dev/null) && [ -n "$_ec_base" ]; then + _ec_range="$_ec_base..HEAD" +else + _ec_range="HEAD" +fi +chk "нет личных email в авторах коммитов" \ + "! git -C '$HERE' log '$_ec_range' --no-merges --format='%ae %ce' | tr ' ' '\n' | grep -vE '(noreply|^\$)' | grep -q ." echo "[канон] chezmoi-source Сознания на месте" for f in chezmoi/dot_claude/CLAUDE.md chezmoi/dot_claude/settings.json.tmpl chezmoi/dot_claude/AGENTS.md.tmpl chezmoi/dot_claude/hooks/security-guard.sh chezmoi/dot_claude/hooks/bash-guard.sh chezmoi/dot_claude/rules/structure.md; do