Skip to content

Commit 2556722

Browse files
northdpoleclaude
andcommitted
chore(staging): script that compares staging code with the GitHub tip
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent 81bd960 commit 2556722

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎scripts/sync_check_staging.sh‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
# Print the stack tip on GitHub vs the commit the staging web image was built from.
3+
# Usage: STAGING_HOST=sg@100.74.143.62 ./scripts/sync_check_staging.sh [branch]
4+
set -euo pipefail
5+
BRANCH="${1:-feat/answer-feedback}"
6+
HOST="${STAGING_HOST:?set STAGING_HOST, e.g. user@host}"
7+
git fetch -q origin "$BRANCH"
8+
TIP="$(git rev-parse --short origin/"$BRANCH")"
9+
# Staging is rsynced from a worktree checked out at the tip; compare file content, not a SHA.
10+
LOCAL="$(git ls-tree -r origin/"$BRANCH" --name-only -- application/utils/comprehension | xargs -I{} git show origin/"$BRANCH":{} | shasum | cut -c1-12)"
11+
REMOTE="$(ssh -n -o BatchMode=yes "$HOST" 'cd /home/sg/Projects/OpenCRE && for f in $(find application/utils/comprehension -type f -name "*.py" | sort); do cat "$f"; done | shasum | cut -c1-12')"
12+
echo "GitHub $BRANCH tip: $TIP"
13+
echo "comprehension code hash github=$LOCAL staging=$REMOTE"

0 commit comments

Comments
 (0)