From 209db753dddcd46467fc95fd9521b3c7d24b459f Mon Sep 17 00:00:00 2001 From: "Eshan Roy (Eshanized)" Date: Fri, 10 May 2024 02:42:15 +0530 Subject: [PATCH] refactor(users): add commitizen validation --- push.sh | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/push.sh b/push.sh index 65ff767..60508a5 100755 --- a/push.sh +++ b/push.sh @@ -1,28 +1,32 @@ #!/bin/bash -# A simple script to maintain github repository +# Author : Eshan Roy +# URI : https://eshanized.github.io -# Author : Eshan Roy -# Author URL : https://eshanized.github.io/ +# NOTE: If you are on Snigdha OS, +# you can install commitizen-go with `sudo pacman -S commitizen-go` +# or `s commitizen-go`. Else you need to install `yay` or `yay-bin` +# to install commitizen. I have written this script only for *Arch Linux. -# REPOSITORY Config -REPO=snigdhaos-system-installation +# Function to check if Commitizen is installed +check_commitizen() { + if ! pacman -Qq commitizen-go &> /dev/null; then + echo "Commitizen is not installed. Please install it using 'yay -S commitizen-go'." >&2 + exit 1 + fi +} -# HOST Config -HOST=https://github.com +# Function to stage, commit, and push changes +push_to_github() { + git add . + git cz + git push origin master +} -# DESTINATION Config -ORG=Snigdha-OS +# Main Function +main() { + check_commitizen + push_to_github +} - -# SETUP REPO URL -REPO_URL="${HOST}/${ORG}/${REPO}.git" -BRANCH="master" #or "main" - -# Commit Message: -MESSAGE="@eshanized: push via push.sh!!!" - -# Git Action -git add . -git commit -m "$MESSAGE" -git push origin "$BRANCH" \ No newline at end of file +main \ No newline at end of file