File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
4+ # Print candidate cndocs files that likely need translation sync
5+ # Strategy:
6+ # 1) Compare upstream/main vs local production for docs/*.md
7+ # 2) Map changed docs/<name>.md -> cndocs/<name>.md when target exists
8+ # 3) Output unique, sorted cndocs paths (one per line)
9+
10+ REPO_ROOT=" $( cd " $( dirname " $0 " ) /.." && pwd) "
11+ cd " $REPO_ROOT "
12+
13+ # Ensure upstream exists
14+ if ! git remote get-url upstream > /dev/null 2>&1 ; then
15+ echo " ERROR: missing upstream remote" >&2
16+ exit 2
17+ fi
18+
19+ git fetch upstream --quiet
20+
21+ # Changed docs files between production and upstream/main
22+ changed_docs=$( git diff --name-only production..upstream/main -- ' docs/*.md' || true)
23+
24+ if [ -z " ${changed_docs} " ]; then
25+ exit 0
26+ fi
27+
28+ while IFS= read -r f; do
29+ [ -z " $f " ] && continue
30+ name=" ${f# docs/ } "
31+ target=" cndocs/${name} "
32+ if [ -f " $target " ]; then
33+ echo " $target "
34+ fi
35+ done <<< " $changed_docs" | sort -u
You can’t perform that action at this time.
0 commit comments