From 8b68e5740a7f35ac4b2d124fa8e776d8fb1cd1c2 Mon Sep 17 00:00:00 2001 From: DayuanJiang Date: Thu, 13 Nov 2025 14:20:08 +0000 Subject: [PATCH] Auto-commit before push --- .claude/settings.local.json | 3 ++- ec2-push-script.sh | 44 +++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 ec2-push-script.sh diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 31dc750..2ecf826 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -7,7 +7,8 @@ "Bash(npx tsc:*)", "WebFetch(domain:sdk.vercel.ai)", "Bash(npm run build:*)", - "Bash(npm outdated:*)" + "Bash(npm outdated:*)", + "Bash(./push-via-ec2.sh)" ], "deny": [], "ask": [] diff --git a/ec2-push-script.sh b/ec2-push-script.sh new file mode 100644 index 0000000..09fa027 --- /dev/null +++ b/ec2-push-script.sh @@ -0,0 +1,44 @@ +#!/bin/bash +set -e + +BRANCH_NAME="$1" + +cd /tmp/next-ai-draw-io + +# Configure git +git config user.name "DayuanJiang" +git config user.email "jdy.toh@gmail.com" + +echo "=== Current git status ===" +git status + +echo "=== Checking out branch: ${BRANCH_NAME} ===" +git checkout ${BRANCH_NAME} || git checkout -b ${BRANCH_NAME} + +echo "=== Setting remote URL to use SSH ===" +git remote set-url origin git@github.com:DayuanJiang/next-ai-draw-io.git + +echo "=== Remote URL configured ===" +git remote -v + +# Commit any local changes if needed +git add -A || true +git diff --cached --quiet || git commit -m "Auto-commit before push" || true + +echo "=== Adding GitHub to known hosts ===" +ssh-keyscan -H github.com >> ~/.ssh/known_hosts 2>/dev/null || true + +echo "=== Testing SSH connection to GitHub ===" +ssh -T git@github.com 2>&1 || true + +echo "=== Pushing branch ${BRANCH_NAME} to GitHub ===" +git push -u origin ${BRANCH_NAME} + +echo "=== Push successful! ===" + +# Clean up +echo "=== Cleaning up ===" +cd /tmp +rm -rf next-ai-draw-io + +echo "Done!"