generated from coulomb/repo-seed
chore: add local consistency sync cli
This commit is contained in:
@@ -7,8 +7,9 @@
|
||||
# ./install_hooks.sh --repo <slug> --remove # remove hook from one repo
|
||||
# ./install_hooks.sh --all --remove # remove hook from all repos
|
||||
#
|
||||
# The hook runs `make fix-consistency REPO=<slug>` in the state-hub after each
|
||||
# commit, keeping the hub in sync with workplan file changes automatically.
|
||||
# The hook runs `statehub fix-consistency --repo <slug>` after each commit,
|
||||
# keeping the hub in sync with workplan file changes automatically. It falls
|
||||
# back to the state-hub Make target when the CLI is not installed.
|
||||
#
|
||||
# Idempotent: the hook block is guarded by a marker comment. Running twice is safe.
|
||||
|
||||
@@ -79,7 +80,11 @@ install_hook() {
|
||||
hook_block=$(cat <<BLOCK
|
||||
${MARKER} — managed by custodian, do not edit this block
|
||||
if curl -sf ${API_BASE}/state/health >/dev/null 2>&1; then
|
||||
(cd "${STATEHUB_DIR}" && make fix-consistency REPO=${slug} >/dev/null 2>&1 &)
|
||||
if command -v statehub >/dev/null 2>&1; then
|
||||
(cd "${repo_path}" && statehub fix-consistency --repo ${slug} >/dev/null 2>&1 &)
|
||||
else
|
||||
(cd "${STATEHUB_DIR}" && make fix-consistency REPO=${slug} >/dev/null 2>&1 &)
|
||||
fi
|
||||
fi
|
||||
${MARKER}-end
|
||||
BLOCK
|
||||
|
||||
Reference in New Issue
Block a user