test
All checks were successful
API接口参数变更检测 / api-param-check (push) Successful in 5m2s

This commit is contained in:
2026-06-03 15:12:25 +08:00
parent 556f5b8ab6
commit a4773ccea3

View File

@@ -1,22 +1,26 @@
# Gitea Actionspush 后检测 Controller 接口参数变更 # Gitea Actionspush 后检测 Controller 接口参数变更
# 工具代码与配置均位于 .gitea/ 目录,与业务代码解耦 # 工具代码与配置均位于 .gitea/ 目录,与业务代码解耦
# 检出方式:使用 gitea.token 直连内网 Git 仓库(避免 actions/checkout 网络问题)
name: API Parameter Change Check name: API接口参数变更检测
run-name: ${{ gitea.actor }}的API参数变更检测
on: on: [push]
push:
branches:
- '**'
jobs: jobs:
api-param-check: 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 runs-on: ubuntu-latest
steps: steps:
- name: 检出代码 - name: 内置权限检出代码
uses: actions/checkout@v4 run: |
with: git config --global http.sslVerify false
fetch-depth: 0 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: 检查配置文件 - name: 检查配置文件
run: | run: |
@@ -26,37 +30,30 @@ jobs:
fi fi
echo "使用 .gitea/config.yaml" echo "使用 .gitea/config.yaml"
- name: 安装 Java 11 - name: 安装 Java、Maven 和 Python
uses: actions/setup-java@v4 run: |
with: echo "安装运行环境..."
distribution: temurin sudo apt-get update
java-version: '11' sudo apt-get install -y openjdk-11-jdk maven python3 python3-pip
cache: maven java -version
mvn -version
python3 --version
echo "环境准备完成"
- name: 安装 Python 3.11 - name: 安装 Python 依赖
uses: actions/setup-python@v5 run: |
with: python3 -m pip install --break-system-packages -r .gitea/checker/requirements.txt
python-version: '3.11'
- name: 构建 AST 解析器 - name: 构建 AST 解析器
working-directory: .gitea/java-parser working-directory: .gitea/java-parser
run: mvn -q package -DskipTests run: mvn -q package -DskipTests
- name: 安装 Python 依赖
run: pip install -r .gitea/checker/requirements.txt
- name: 检测 Controller 接口参数变更 - name: 检测 Controller 接口参数变更
run: | run: |
python .gitea/checker/main.py \ 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 \ --config .gitea/config.yaml \
--repo-root . \ --repo-root . \
"${{ gitea.actor }}" \ "${{ gitea.actor }}" \
"$(git log -1 --format=%ci)" "$COMMIT_TIME"
- name: 上传变更日志
if: always()
uses: actions/upload-artifact@v4
with:
name: api-change-logs
path: .gitea/logs/api-changes/
if-no-files-found: ignore