From a78f1026cb3f29751d12b5c6f1f12aca991889be Mon Sep 17 00:00:00 2001 From: "Eshan Roy (Eshanized)" Date: Thu, 2 May 2024 22:05:46 +0530 Subject: [PATCH] feat(push): re write push script with commitizen validation --- push.sh | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/push.sh b/push.sh index 4287ca8..60508a5 100755 --- a/push.sh +++ b/push.sh @@ -1 +1,32 @@ -# \ No newline at end of file +#!/bin/bash + +# Author : Eshan Roy +# URI : 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. + +# 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 +} + +# Function to stage, commit, and push changes +push_to_github() { + git add . + git cz + git push origin master +} + +# Main Function +main() { + check_commitizen + push_to_github +} + +main \ No newline at end of file