diff --git a/.gitea/conventional_commits/commit-msg b/.gitea/conventional_commits/commit-msg old mode 100644 new mode 100755 index 67face6..e08631d --- a/.gitea/conventional_commits/commit-msg +++ b/.gitea/conventional_commits/commit-msg @@ -7,7 +7,7 @@ echo "Running commit message checks..." # Get the commit message commit="$(cat .git/COMMIT_EDITMSG)" # Define the conventional commit regex -regex='^((build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(.+\))?(!?):\s([a-zA-Z0-9-_!\&\.\%\(\)\=\w\s]+)\s?(,?\s?)((ref(s?):?\s?)(([A-Z0-9]+\-[0-9]+)|(NOISSUE))?))|(release: .*)$' +regex='^((build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(.+\))?(!?):\s([a-zA-Z0-9-_!\&\.\%\(\)\=\w\s]+)(\s?(,?\s?)((ref(s?):?\s?)(([A-Z0-9]+\-[0-9]+)|(NOISSUE)))?))|(release: .*)$' # Check if the commit message matches the conventional commit format if ! echo "$commit" | grep -Pq "$regex" diff --git a/.gitea/conventional_commits/generate-version.sh b/.gitea/conventional_commits/generate-version.sh index 9ad4612..71bda15 100755 --- a/.gitea/conventional_commits/generate-version.sh +++ b/.gitea/conventional_commits/generate-version.sh @@ -64,16 +64,16 @@ start() { while read message; do echo $message - if echo $message | grep -Pq '(feat|style)(\([\w]+\))?!:([a-zA-Z0-9-_!\&\.\%\(\)\=\w\s]+)\s?(,?\s?)((ref(s?):?\s?)(([A-Z0-9]+\-[0-9]+)|(#[0-9]+)|(NOISSUE))?)'; then + if echo $message | grep -Pq '(feat|style)(\([\w]+\))?!:([a-zA-Z0-9-_!\&\.\%\(\)\=\w\s]+)(\s?(,?\s?)((ref(s?):?\s?)(([A-Z0-9]+\-[0-9]+)|(#[0-9]+)|(NOISSUE)))?)'; then increment_type="major" echo "a" break - elif echo $message | grep -Pq '(feat|style)(\([\w]+\))?:([a-zA-Z0-9-_!\&\.\%\(\)\=\w\s]+)\s?(,?\s?)((ref(s?):?\s?)(([A-Z0-9]+\-[0-9]+)|(#[0-9]+)|(NOISSUE))?)'; then + elif echo $message | grep -Pq '(feat|style)(\([\w]+\))?:([a-zA-Z0-9-_!\&\.\%\(\)\=\w\s]+)(\s?(,?\s?)((ref(s?):?\s?)(([A-Z0-9]+\-[0-9]+)|(#[0-9]+)|(NOISSUE)))?)'; then if [ -z "$increment_type" ] || [ "$increment_type" == "patch" ]; then increment_type="minor" echo "b" fi - elif echo $message | grep -Pq '(build|fix|perf|refactor|revert)(\(.+\))?:\s([a-zA-Z0-9-_!\&\.\%\(\)\=\w\s]+)\s?(,?\s?)((ref(s?):?\s?)(([A-Z0-9]+\-[0-9]+)|(#[0-9]+)|(NOISSUE))?)'; then + elif echo $message | grep -Pq '(build|fix|perf|refactor|revert)(\(.+\))?:\s([a-zA-Z0-9-_!\&\.\%\(\)\=\w\s]+)(\s?(,?\s?)((ref(s?):?\s?)(([A-Z0-9]+\-[0-9]+)|(#[0-9]+)|(NOISSUE)))?)'; then if [ -z "$increment_type" ]; then increment_type="patch" echo "c"