-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRoot
More file actions
58 lines (50 loc) · 1.83 KB
/
Root
File metadata and controls
58 lines (50 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# SDKP GitHub Automation Script
# Author: Donald Paul Smith (FatherTimeSDKP)
# Date: 2025-10-27
# Description: Automates the Git add, commit, and push process.
#
# --- Robust error handling ---
set -euo pipefail
# --- 1. Define Variables ---
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
# --- 2. Pre-Check: Verify Git Repository ---
if [ -z "$REPO_ROOT" ]; then
echo "🚨 ERROR: Current directory is NOT a Git repository."
echo "Please initialize the repository first (git init) and ensure you have linked a remote (git remote add origin ...)."
exit 1
fi
# --- 3. Stage Files ---
echo "--- $(date '+%Y-%m-%d %H:%M:%S') ---"
echo "Staging all changes in the SDKP repository..."
git add .
# Check if there are any changes to commit
if git diff --cached --quiet --exit-code; then
echo "✅ Working tree clean. No new changes found to commit."
exit 0
fi
# --- 4. Get Commit Message ---
read -r -p "Enter your commit message (e.g., 'Update SDKP equations' or 'DCP Protocol sync'): " COMMIT_MSG
# Ensure the commit message is not empty
if [ -z "$COMMIT_MSG" ]; then
COMMIT_MSG="Automated update from FatherTimeSDKP"
fi
# --- 5. Commit Changes ---
echo "Committing changes with message: '$COMMIT_MSG'"
if ! git commit -m "$COMMIT_MSG"; then
echo "❌ ERROR: Git commit failed. See output above."
exit 1
fi
# --- 6. Push to GitHub ---
echo "Pushing changes to remote 'origin' on branch '$BRANCH_NAME'..."
# The success of this command depends on SSH or PAT being configured:
if git push origin "$BRANCH_NAME"; then
echo ""
echo "🚀 SUCCESS! SDKP repository updated on GitHub."
echo "Branch: $BRANCH_NAME"
echo "Commit: $COMMIT_MSG"
else
echo "❌ ERROR: Git push failed. Please verify your authentication (SSH/PAT) and connectivity."
exit 1
fi