From ab4fe786a86963e79bd310cba70704ca7b556577 Mon Sep 17 00:00:00 2001 From: "Eshan Roy (Eshanized)" Date: Thu, 2 May 2024 22:12:11 +0530 Subject: [PATCH] feat(script): add commitizen validation rather than static push script --- push.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 push.sh diff --git a/push.sh b/push.sh new file mode 100755 index 0000000..60508a5 --- /dev/null +++ b/push.sh @@ -0,0 +1,32 @@ +#!/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