diff --git a/.githooks/commit-msg b/.githooks/commit-msg new file mode 100644 index 000000000..ff1d47a9e --- /dev/null +++ b/.githooks/commit-msg @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# +# @author : Mak Sophea +# @version : 1.0# +# Create a regex for a conventional commit. +commit_types="(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test|wip)" +convetional_commit_regex="^${commit_types}(\([a-z \-]+\))?!?: .+$" + +# Get the commit message (the parameter we're given is just the path to the +# temporary file which holds the message). +commit_message=$(cat "$1") + +# Check the message, if we match, all good baby. +if [[ "$commit_message" =~ $convetional_commit_regex ]]; then + echo -e "\e[32mCommit message meets Conventional Commit standards...\e[0m" + exit 0 +fi + +# Uh-oh, this is not a conventional commit, show an example and link to the spec. +echo -e "\e[31mThe commit message does not meet the Conventional Commit standard\e[0m" +echo "An example of a valid message is: " +echo " feat(login): add the 'remember me' button" +echo "More details at: https://www.conventionalcommits.org/en/v1.0.0/#summary" +echo "***********************************************************************" +echo "Here are the list of message type : ${commit_types}" +echo " : max 50char ex :- fix: invalid request for login api" +echo " ):> (Max 50 char) - is option ex: - fix(user): email address is empty on profile api" +echo "***********************************************************************" + +exit 1 \ No newline at end of file diff --git a/.githooks/git-hooks-config.sh b/.githooks/git-hooks-config.sh new file mode 100644 index 000000000..c0fbfd134 --- /dev/null +++ b/.githooks/git-hooks-config.sh @@ -0,0 +1,7 @@ +#!/bin/sh +# This script will config git hook path into specific folder in your project. This script will invoked by maven build. +# @author : Mak Sophea +# @version : 1.0# +# +echo "config git hooksPath to .githooks folder for commit-msg and pre-push" +git config core.hooksPath .githooks \ No newline at end of file diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 38165cd85..752b33975 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -2,15 +2,21 @@ name: Lint and Test Charts on: push: - branches: [ "main" ] + branches: [ "main", "release-*" ] pull_request: - branches: [ "main" ] + branches: [ "main", "release-*" ] jobs: lint-test: runs-on: ubuntu-latest steps: + - name: PR Conventional Commit Validation + uses: ytanikin/PRConventionalCommits@1.1.0 + with: + task_types: '["feat","fix","docs","test","ci","refactor","perf","chore","revert"]' + add_label: 'true' + - name: Checkout uses: actions/checkout@v3 with: diff --git a/.github/workflows/release-daily.yaml b/.github/workflows/release-daily.yaml index 4bc76c92a..d2c3e0522 100644 --- a/.github/workflows/release-daily.yaml +++ b/.github/workflows/release-daily.yaml @@ -21,7 +21,7 @@ jobs: run: | v=1.5.0-$(date +"%Y%m%d") echo "tag_version=$v" >> $GITHUB_OUTPUT - echo "latest_version=1.4.1" + echo "latest_version=1.4.2" - name: Package installer run: |