#!/usr/bin/env bash set -euo pipefail ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" EVENT="${1:-commit}" current_branch() { git -C "$ROOT_DIR" rev-parse --abbrev-ref HEAD 2>/dev/null || echo "" } update_code_review_graph_if_main() { local branch branch="$(current_branch)" if [[ "$branch" != "main" ]]; then return 0 fi if ! command -v code-review-graph >/dev/null 2>&1; then echo "[post-git-hook] code-review-graph not found, skipping update" >&2 return 0 fi echo "[post-git-hook] updating code-review-graph on branch main" >&2 if ! (cd "$ROOT_DIR" && code-review-graph update); then echo "[post-git-hook] code-review-graph update failed, continuing" >&2 fi } update_code_review_graph_if_main exec "$ROOT_DIR/scripts/sync_devone_changed_files.sh" "$EVENT"