From d3b5426e676df9ebeb2c348c28ded6f06e8e8436 Mon Sep 17 00:00:00 2001 From: Eshan Roy <148610067+eshanized@users.noreply.github.com> Date: Fri, 5 Jul 2024 15:27:10 +0530 Subject: [PATCH 1/3] (script): + conventional commit --- push.sh | 70 ++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 45 insertions(+), 25 deletions(-) diff --git a/push.sh b/push.sh index 60508a5..8d7689a 100755 --- a/push.sh +++ b/push.sh @@ -1,32 +1,52 @@ #!/bin/bash -# Author : Eshan Roy -# URI : https://eshanized.github.io +# Author : ESHAN ROY +# Author 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. +# NOTE : RUN AT YOUR OWN RISK! -# 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 -} +# Define the conventional commit types with emojis +TYPES=("๐ŸŽ‰ feat" "๐Ÿž fix" "๐Ÿ“š docs" "๐Ÿ’… style" "๐Ÿ”จ refactor" "โšก๏ธ perf" "๐Ÿงช test" "๐Ÿ› ๏ธ build" "๐Ÿค– ci" "๐Ÿงน chore" "โช๏ธ revert") -# Function to stage, commit, and push changes -push_to_github() { - git add . - git cz - git push origin master -} +# Prompt the user to select a commit type +echo "Select a commit type:" +select type in "${TYPES[@]}"; do + break +done -# Main Function -main() { - check_commitizen - push_to_github -} +# Extract the commit type and emoji from the selection +type_emoji=${type} +type=${type_emoji#* } +emoji=${type_emoji% *} -main \ No newline at end of file +# 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) \ No newline at end of file From c19e9d106a5bcd14a96f0e4413bd6d69713ff7f9 Mon Sep 17 00:00:00 2001 From: Eshan Roy <148610067+eshanized@users.noreply.github.com> Date: Fri, 5 Jul 2024 15:29:19 +0530 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=A4=96=20ci(upgrade):=20own=20convent?= =?UTF-8?q?ional=20commit=20checker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/commit.yml | 38 +++++++++++++++++++ .../snigdhaos-commitizen-on-push.yml | 30 --------------- .../workflows/snigdhaos-commitzen-on-pull.yml | 30 --------------- 3 files changed, 38 insertions(+), 60 deletions(-) create mode 100644 .github/workflows/commit.yml delete mode 100644 .github/workflows/snigdhaos-commitizen-on-push.yml delete mode 100644 .github/workflows/snigdhaos-commitzen-on-pull.yml diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml new file mode 100644 index 0000000..5cda42d --- /dev/null +++ b/.github/workflows/commit.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/snigdhaos-commitizen-on-push.yml b/.github/workflows/snigdhaos-commitizen-on-push.yml deleted file mode 100644 index 5f3fa55..0000000 --- a/.github/workflows/snigdhaos-commitizen-on-push.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Snigdha OS Commitizen Check on Push - -on: - push: - branches: - - master - -jobs: - commitizen_check: - name: Check Commitizen Commit on Push - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Install Node.js - uses: actions/setup-node@v3 - with: - node-version: '14' - - - name: Install Commitizen - run: npm install -g commitizen - - - name: Verify Commitizen Commit - run: | - if git log --format='%s' ${{ github.event.before }}..${{ github.sha }} | grep -v '^(feat|fix|docs|style|refactor|perf|test|chore)(\(.+\))?: .+'; then - echo "Invalid commit message found. Please use Commitizen convention." - exit 1 - fi \ No newline at end of file diff --git a/.github/workflows/snigdhaos-commitzen-on-pull.yml b/.github/workflows/snigdhaos-commitzen-on-pull.yml deleted file mode 100644 index c80a671..0000000 --- a/.github/workflows/snigdhaos-commitzen-on-pull.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Snigdha OS Commitizen Check On Pull - -on: - pull_request: - branches: - - master - -jobs: - commitizen_check: - name: Check Commitizen Commit on Pull Request - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Install Node.js - uses: actions/setup-node@v3 - with: - node-version: '14' - - - name: Install Commitizen - run: npm install -g commitizen - - - name: Verify Commitizen Commit - run: | - if git log --format='%s' ${{ github.event.before }}..${{ github.sha }} | grep -v '^(feat|fix|docs|style|refactor|perf|test|chore)(\(.+\))?: .+'; then - echo "Invalid commit message found. Please use Commitizen convention." - exit 1 - fi \ No newline at end of file From 6fe7f1d2528782f3c9a71b4dbcb23a7f32b5082c Mon Sep 17 00:00:00 2001 From: Eshan Roy <148610067+eshanized@users.noreply.github.com> Date: Fri, 5 Jul 2024 15:32:19 +0530 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=90=9E=20fix(url):=20change=20to=20go?= =?UTF-8?q?ogle.com?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qt/snigdhaosassistant.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qt/snigdhaosassistant.cpp b/qt/snigdhaosassistant.cpp index eacaf61..f19df47 100644 --- a/qt/snigdhaosassistant.cpp +++ b/qt/snigdhaosassistant.cpp @@ -19,7 +19,7 @@ /* * 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.