From be5362360f54b3faf6f18161c32dc0b70b08365e Mon Sep 17 00:00:00 2001 From: "Eshan Roy (Eshanized)" <148610067+eshanized@users.noreply.github.com> Date: Tue, 18 Jun 2024 03:35:06 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(alt):=20remove=20npm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/commitizen.yml | 38 +++++++++++++++++++------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/.github/workflows/commitizen.yml b/.github/workflows/commitizen.yml index 3f3844a..8cb5461 100644 --- a/.github/workflows/commitizen.yml +++ b/.github/workflows/commitizen.yml @@ -1,27 +1,35 @@ -name: Conventional Commit Check +name: Check Conventional Commit on: push: branches: - - master # Adjust to match your main branch name + - main jobs: - check-commits: + check-commit-message: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v2 + - name: Checkout code + uses: actions/checkout@v2 - - name: Set up Node.js - uses: actions/setup-node@v2 - with: - node-version: '16' + - name: Check Conventional Commit + run: | + # Define the conventional commit types with emojis + TYPES=("๐ŸŽ‰ feat" "๐Ÿž fix" "๐Ÿ“š docs" "๐Ÿ’… style" "๐Ÿ”จ refactor" "โšก๏ธ perf" "๐Ÿงช test" "๐Ÿ› ๏ธ build" "๐Ÿค– ci" "๐Ÿงน chore" "โช๏ธ revert") - - name: Install dependencies - run: npm install # Ensure to have npm dependencies set up + # 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 - - name: Run commit script - run: bash ./push.sh - - # You can add additional steps here for testing, linting, etc. \ No newline at end of file + # 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