mirror of
https://github.com/Snigdha-OS/snigdhaos-assistant.git
synced 2025-09-20 19:45:01 +02:00
Merge branch 'Snigdha-OS:master' into master
This commit is contained in:
38
.github/workflows/commit.yml
vendored
Normal file
38
.github/workflows/commit.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
name: Check Conventional Commit
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-commit-message:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Check Conventional Commit
|
||||||
|
run: |
|
||||||
|
# Define the conventional commit types with emojis
|
||||||
|
TYPES=("🎉 feat" "🐞 fix" "📚 docs" "💅 style" "🔨 refactor" "⚡️ perf" "🧪 test" "🛠️ build" "🤖 ci" "🧹 chore" "⏪️ revert")
|
||||||
|
|
||||||
|
# Extract the commit type and emoji from the commit message
|
||||||
|
COMMIT_MSG=$(git log --format=%B -n 1)
|
||||||
|
for type in "${TYPES[@]}"; do
|
||||||
|
type_emoji=${type}
|
||||||
|
type=${type_emoji#* }
|
||||||
|
emoji=${type_emoji% *}
|
||||||
|
if [[ $COMMIT_MSG == $emoji* ]]; then
|
||||||
|
echo "Commit message is a conventional commit"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# If we reach here, the commit message is not a conventional commit
|
||||||
|
echo "Commit message is not a conventional commit"
|
||||||
|
exit 1
|
70
push.sh
70
push.sh
@@ -1,32 +1,52 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Author : Eshan Roy
|
# Author : ESHAN ROY
|
||||||
# URI : https://eshanized.github.io
|
# Author URI : https://eshanized.github.io
|
||||||
|
|
||||||
# NOTE: If you are on Snigdha OS,
|
# NOTE : RUN AT YOUR OWN RISK!
|
||||||
# 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
|
# Define the conventional commit types with emojis
|
||||||
check_commitizen() {
|
TYPES=("🎉 feat" "🐞 fix" "📚 docs" "💅 style" "🔨 refactor" "⚡️ perf" "🧪 test" "🛠️ build" "🤖 ci" "🧹 chore" "⏪️ revert")
|
||||||
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
|
# Prompt the user to select a commit type
|
||||||
push_to_github() {
|
echo "Select a commit type:"
|
||||||
git add .
|
select type in "${TYPES[@]}"; do
|
||||||
git cz
|
break
|
||||||
git push origin master
|
done
|
||||||
}
|
|
||||||
|
|
||||||
# Main Function
|
# Extract the commit type and emoji from the selection
|
||||||
main() {
|
type_emoji=${type}
|
||||||
check_commitizen
|
type=${type_emoji#* }
|
||||||
push_to_github
|
emoji=${type_emoji% *}
|
||||||
}
|
|
||||||
|
|
||||||
main
|
# Prompt the user to enter a scope (optional)
|
||||||
|
read -p "Enter a scope (optional): " scope
|
||||||
|
|
||||||
|
# Prompt the user to enter a short description
|
||||||
|
read -p "Enter a short description: " desc
|
||||||
|
|
||||||
|
# Prompt the user to enter a longer description (optional)
|
||||||
|
read -p "Enter a longer description (optional): " long_desc
|
||||||
|
|
||||||
|
# Create the commit message
|
||||||
|
commit_msg="$emoji $type($scope): $desc"
|
||||||
|
|
||||||
|
# If a longer description was provided, add it to the commit message
|
||||||
|
if [ -n "$long_desc" ]; then
|
||||||
|
commit_msg+="
|
||||||
|
|
||||||
|
$long_desc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Print the commit message to the console
|
||||||
|
echo "Commit message:"
|
||||||
|
echo "$commit_msg"
|
||||||
|
|
||||||
|
# Stage all changes
|
||||||
|
git add .
|
||||||
|
|
||||||
|
# Commit the changes with the conventional commit message
|
||||||
|
git commit -m "$commit_msg"
|
||||||
|
|
||||||
|
# Push the changes to the remote repository
|
||||||
|
git push origin $(git rev-parse --abbrev-ref HEAD)
|
@@ -19,7 +19,7 @@
|
|||||||
/*
|
/*
|
||||||
* a constant variable INTERNET_CHECK_URL which stores the URL to check for internet connectivity.
|
* a constant variable INTERNET_CHECK_URL which stores the URL to check for internet connectivity.
|
||||||
*/
|
*/
|
||||||
const char* INTERNET_CHECK_URL = "https://snigdhaos.org";
|
const char* INTERNET_CHECK_URL = "https://google.com/";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* constructor for the SnigdhaOSAssistant class.
|
* constructor for the SnigdhaOSAssistant class.
|
||||||
|
Reference in New Issue
Block a user