ci(upstream-merge): refine branding guard to only flag user-facing strings in code (ignore docs/comments)

This commit is contained in:
James Peter
2025-09-09 10:42:55 +10:00
parent 94aa78af35
commit da7581de75
+14 -9
View File
@@ -564,15 +564,20 @@ jobs:
if git diff --name-only "origin/${DEFAULT_BRANCH}..origin/upstream-merge" -- 'docs/**' | grep -q .; then
echo "::notice::docs/** changed on upstream-merge; ensuring agent reviews and preserves local branding where needed." >&2
fi
# Branding guard: block additions of user-visible 'Codex' in TUI/CLI/docs (allow crate/package contexts)
if git diff -U0 --no-color "origin/${DEFAULT_BRANCH}..origin/upstream-merge" -- codex-rs/tui/** codex-cli/** docs/** \
| grep -E '^\+' \
| grep -Ei '\bCodex\b' \
| grep -Evi '(codex-rs|codex-[a-z0-9_-]+|https?://|Cargo|crate|package|workspace)' >/dev/null 2>&1; then
echo "Branding guard tripped: new user-visible 'Codex' strings detected in TUI/CLI/docs." >&2
git diff -U0 --no-color "origin/${DEFAULT_BRANCH}..origin/upstream-merge" -- codex-rs/tui/** codex-cli/** docs/** \
| grep -E '^\+' | grep -Ei '\bCodex\b' | sed 's/^/> /' >&2 || true
exit 1
# Branding guard: user-facing strings only, in TUI/CLI code (ignore docs/ and comments)
changed_files=$(git diff --name-only "origin/${DEFAULT_BRANCH}..origin/upstream-merge" -- 'codex-rs/tui/**' 'codex-cli/**' | tr '\n' ' ' || true)
if [ -n "${changed_files:-}" ]; then
if git diff -U0 --no-color "origin/${DEFAULT_BRANCH}..origin/upstream-merge" -- $changed_files \
| grep -E '^\+' \
| grep -E '"[^"]*Codex[^"]*"|'\''[^'\''']*Codex[^'\''']*'\''|`[^`]*Codex[^`]*`' \
| grep -Evi '(codex-rs|codex-[a-z0-9_-]+|https?://|Cargo|crate|package|workspace)' >/dev/null 2>&1; then
echo "Branding guard tripped: new user-visible 'Codex' strings detected in TUI/CLI code." >&2
git diff -U0 --no-color "origin/${DEFAULT_BRANCH}..origin/upstream-merge" -- $changed_files \
| grep -E '^\+' \
| grep -E '"[^"]*Codex[^"]*"|'\''[^'\''']*Codex[^'\''']*'\''|`[^`]*Codex[^`]*`' \
| sed 's/^/> /' >&2 || true
exit 1
fi
fi
# Perma-deleted guard: ensure none of perma_removed_paths exist on branch
if command -v jq >/dev/null 2>&1 && [ -f ".github/merge-policy.json" ]; then