All checks were successful
API接口参数变更检测 / api-param-check (push) Successful in 5m2s
60 lines
2.1 KiB
YAML
60 lines
2.1 KiB
YAML
# Gitea Actions:push 后检测 Controller 接口参数变更
|
||
# 工具代码与配置均位于 .gitea/ 目录,与业务代码解耦
|
||
# 检出方式:使用 gitea.token 直连内网 Git 仓库(避免 actions/checkout 网络问题)
|
||
|
||
name: API接口参数变更检测
|
||
run-name: ${{ gitea.actor }}的API参数变更检测
|
||
|
||
on: [push]
|
||
|
||
jobs:
|
||
api-param-check:
|
||
# 排除指定分支(与现有 AI 审查 workflow 保持一致,可按需修改)
|
||
if: ${{ gitea.ref != 'refs/heads/pre' && gitea.ref != 'refs/heads/dev' && gitea.ref != 'refs/heads/master-2.0' }}
|
||
runs-on: ubuntu-latest
|
||
|
||
steps:
|
||
- name: 内置权限检出代码
|
||
run: |
|
||
git config --global http.sslVerify false
|
||
git clone "https://${{ gitea.token }}@git.niujiekeji.com/${{ gitea.repository }}.git" .
|
||
git checkout ${{ gitea.sha }}
|
||
echo "当前提交: $(git rev-parse HEAD)"
|
||
echo "上一提交: $(git rev-parse HEAD~1 2>/dev/null || echo '无')"
|
||
|
||
- name: 检查配置文件
|
||
run: |
|
||
if [ ! -f .gitea/config.yaml ]; then
|
||
echo "错误: 缺少 .gitea/config.yaml"
|
||
exit 1
|
||
fi
|
||
echo "使用 .gitea/config.yaml"
|
||
|
||
- name: 安装 Java、Maven 和 Python
|
||
run: |
|
||
echo "安装运行环境..."
|
||
sudo apt-get update
|
||
sudo apt-get install -y openjdk-11-jdk maven python3 python3-pip
|
||
java -version
|
||
mvn -version
|
||
python3 --version
|
||
echo "环境准备完成"
|
||
|
||
- name: 安装 Python 依赖
|
||
run: |
|
||
python3 -m pip install --break-system-packages -r .gitea/checker/requirements.txt
|
||
|
||
- name: 构建 AST 解析器
|
||
working-directory: .gitea/java-parser
|
||
run: mvn -q package -DskipTests
|
||
|
||
- name: 检测 Controller 接口参数变更
|
||
run: |
|
||
echo "执行 API 参数变更检测..."
|
||
COMMIT_TIME=$(git log -1 --format=%cd --date=format:'%Y-%m-%d %H:%M:%S')
|
||
python3 .gitea/checker/main.py \
|
||
--config .gitea/config.yaml \
|
||
--repo-root . \
|
||
"${{ gitea.actor }}" \
|
||
"$COMMIT_TIME"
|