From 52f3a0bdc88617a5196018fdb474ec0b89ac9eb6 Mon Sep 17 00:00:00 2001 From: eshanized Date: Sun, 12 Jan 2025 22:06:06 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20ci:=20upgrade=20workflows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/commitizen.yml | 33 --------------------------- .github/workflows/cz.yml | 38 ++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 33 deletions(-) delete mode 100644 .github/workflows/commitizen.yml create mode 100644 .github/workflows/cz.yml diff --git a/.github/workflows/commitizen.yml b/.github/workflows/commitizen.yml deleted file mode 100644 index ac93cb1..0000000 --- a/.github/workflows/commitizen.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Commitizen Check on Push and Pull - -on: - push: - branches: - - master - pull_request: - 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/cz.yml b/.github/workflows/cz.yml new file mode 100644 index 0000000..fee284c --- /dev/null +++ b/.github/workflows/cz.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