Files
Ruben Fiszel a28a68258c add cli-sync workspace snapshot/load scripts (#9322)
* feat(fixtures): add cli-sync workspace snapshot/load scripts

* fix(fixtures): address review nits (env var password, mktemp, dead refs)

* fix(fixtures): address CI review (SIGPIPE, JSON escaping, doc/code drift)
2026-05-26 04:35:05 +00:00

28 lines
996 B
Bash
Executable File

#!/usr/bin/env bash
# Fail if fixtures/cli-sync/ contains anything beyond the fixture scaffold
# (wmill.yaml, .gitkeep). Used by CI to guard `main` against accidentally
# merging PRs with a test workspace snapshot still committed.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
DIR="${1:-$SCRIPT_DIR/cli-sync}"
ALLOWED_RE='^fixtures/cli-sync/(\.gitkeep|wmill\.yaml)$'
# Use `git ls-files` so we only check tracked files. Untracked local snapshots
# are fine — devs may keep them locally between sessions.
EXTRA=$(cd "$REPO_ROOT" && git ls-files fixtures/cli-sync \
| grep -vE "$ALLOWED_RE" || true)
if [[ -n "$EXTRA" ]]; then
echo "✗ fixtures/cli-sync/ contains committed snapshot files:" >&2
echo "$EXTRA" | sed 's/^/ /' >&2
echo >&2
echo " Run fixtures/snapshot.sh against an empty workspace or" >&2
echo " remove the files before merging." >&2
exit 1
fi
echo "✓ fixtures/cli-sync/ is clean"