🔬 test: new test script

This commit is contained in:
eshanized
2025-01-06 23:35:39 +05:30
parent 4a6915c6a0
commit c25b838efb

11
push.sh
View File

@@ -6,7 +6,7 @@
# Define the conventional commit types with new emojis
TYPES=("🚀 feat" "🐛 fix" "📝 docs" "✨ style" "🛠 refactor" "⚡️ perf" "🔬 test" "🔧 build" "🤖 ci" "🧹 chore" "⏪ revert")
# Function to display an error and exit and
# Function to display an error and exit
error_exit() {
echo -e "\033[1;31m[ERROR]\033[0m $1"
exit 1
@@ -22,6 +22,11 @@ branch=$(git rev-parse --abbrev-ref HEAD)
echo "Pulling latest changes from remote branch '$branch'..."
git pull origin "$branch" || error_exit "Failed to pull changes from the remote repository. Please resolve any conflicts manually."
# Check if there are changes to commit
if git diff --quiet && git diff --cached --quiet; then
error_exit "No changes detected to commit."
fi
# Prompt the user to select a commit type
echo "Select a commit type:"
select type in "${TYPES[@]}"; do
@@ -65,7 +70,7 @@ git add .
if git commit -m "$commit_msg"; then
echo -e "\033[1;32mCommit successful!\033[0m"
else
error_exit "Commit failed."
error_exit "Commit failed. Please check your changes and try again."
fi
# Push the changes to the remote repository
@@ -74,4 +79,4 @@ if git push origin "$branch"; then
echo -e "\033[1;32mChanges pushed to remote branch '$branch'.\033[0m"
else
error_exit "Push failed. Please check your connection or branch permissions."
fi
fi