mirror of
https://github.com/Snigdha-OS/snigdhaos-grub-theme.git
synced 2025-09-20 19:14:56 +02:00
refactor(commitizen): push with commitizen validation
This commit is contained in:
45
push.sh
45
push.sh
@@ -1,27 +1,32 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Author : Eshan Roy <eshan@snigdhaos.org>
|
# Author : Eshan Roy
|
||||||
# Author URI : https://eshanized.github.io/
|
# URI : https://eshanized.github.io
|
||||||
|
|
||||||
# NOTE: REPO = Your Repository Name On the Host
|
# NOTE: If you are on Snigdha OS,
|
||||||
# NOTE: ORG = Your ORGANIZATION NAME or USERNAME
|
# you can install commitizen-go with `sudo pacman -S commitizen-go`
|
||||||
# NOTE: HOST = GitHub, Gitlab, Bitbucket etc.
|
# 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.
|
||||||
|
|
||||||
# Repo Config
|
# Function to check if Commitizen is installed
|
||||||
REPO=snigdhaos-grub-theme
|
check_commitizen() {
|
||||||
# Host Config
|
if ! pacman -Qq commitizen-go &> /dev/null; then
|
||||||
HOST=https://github.com
|
echo "Commitizen is not installed. Please install it using 'yay -S commitizen-go'." >&2
|
||||||
# Destination Config
|
exit 1
|
||||||
ORG=Snigdha-OS
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Set the repository URL and branch
|
# Function to stage, commit, and push changes
|
||||||
REPO_URL="${HOST}/${ORG}/${REPO}.git"
|
push_to_github() {
|
||||||
BRANCH="master" # or "main" depending on your repository's default branch
|
git add .
|
||||||
|
git cz
|
||||||
|
git push origin master
|
||||||
|
}
|
||||||
|
|
||||||
# Commit message
|
# Main Function
|
||||||
MESSAGE="@eshanized: push via script"
|
main() {
|
||||||
|
check_commitizen
|
||||||
|
push_to_github
|
||||||
|
}
|
||||||
|
|
||||||
# Add all files, commit, and push changes
|
main
|
||||||
git add .
|
|
||||||
git commit -m "$MESSAGE"
|
|
||||||
git push origin $BRANCH
|
|
Reference in New Issue
Block a user