This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # 检查 diff 代码行数是否大于 10000 | |
| diff_lines=$(git diff dev --numstat | awk '{ sum += $1 + $2 } END { print sum }') | |
| if [ $diff_lines -gt 10000 ]; then | |
| echo "There are more than 10000 lines changed in current merge request" | |
| exit 1 | |
| fi | |
| # 检查 diff commits 数目是否大于 100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| basic="(master|develop|main)" | |
| lints="((build|ci|chore|docs|feat|(hot)?fix|perf|refactor|revert|style|test|optimize)/.+)" | |
| other="((release-v[0-9]+\.[0-9]+\.[0-9]+(-[a-z0-9.]+(\+[a-z0-9.]+)?)?)|revert-[a-z0-9]+)" | |
| pattern="^(${basic}|${lints}|${other})$" | |
| current=$(git status | head -n1 | sed 's/On branch //') | |
| name=${1:-$current} | |
| if [[ ! $name =~ $pattern ]]; then |