# Gitee Go Workflow - Commitlint (简化版本) # 如果 commitlint.yml 不兼容,可以尝试使用此版本 # 使用方法:将此文件重命名为 commitlint.yml name: commitlint-simple displayName: Commitlint 提交信息检查(简化版) trigger: push: branches: - master pull_request: types: - opened - synchronize stages: - name: lint displayName: 提交信息检查 steps: - name: 安装依赖并检查提交信息 type: shell commands: | # 检查 Node.js 是否可用 if command -v node >/dev/null 2>&1; then echo "Node.js 已安装: $(node --version)" else echo "错误: 未找到 Node.js,请确保 Gitee Go 环境已安装 Node.js" exit 1 fi # 安装 commitlint npm install -g @commitlint/cli @commitlint/config-conventional # 创建配置文件 echo '{"extends": ["@commitlint/config-conventional"]}' > .commitlintrc.json # 检查提交信息(简化版:只检查最新提交) echo "检查最新提交信息..." npx commitlint --from HEAD~1 --to HEAD --verbose