Elffuss BraidHub

utopia-ia/elffuss-braid public

52e22f93c9da · 1.3 KiB · executableRawPermalink
1#!/usr/bin/env bash
2# SPDX-License-Identifier: Apache-2.0
3# Copyright (c) 2026 UtopiaIA
4#
5# Fails if the repository would publish data that identifies a machine or a
6# person: home-directory paths in tracked files, co-author or tool-attribution
7# trailers in history, or maintainer commits without the noreply address.
8# CI runs it on every push; run it locally before pushing too.
9set -euo pipefail
10
11status=0
12report() {
13 echo "privacy-check: $1" >&2
14 status=1
15}
16
17# 1. Home-directory paths in tracked text files. CI runner paths are fine.
18if hits=$(git grep -nIE '/(Users|home)/[A-Za-z0-9._-]+/' -- . ':(exclude)scripts/privacy-check.sh' |
19 grep -vE '/[h]ome/runner/'); then
20 echo "$hits" >&2
21 report "home-directory paths in tracked files"
22fi
23
24# 2. Co-author and tool-attribution trailers anywhere in history.
25if git log --format=%B | grep -qiE '^co-authored-by:|generated with .*claude'; then
26 report "attribution trailer in a commit message"
27fi
28
29# 3. The maintainer account commits with its noreply address only.
30if bad=$(git log --format='%an <%ae>%n%cn <%ce>' | sort -u | grep -E '^KikoCis <' |
31 grep -v '<KikoCis@users.noreply.github.com>$'); then
32 echo "$bad" >&2
33 report "maintainer identity without the noreply address"
34fi
35
36if [ "$status" -eq 0 ]; then
37 echo "privacy-check: clean"
38fi
39exit "$status"