This commit is contained in:
62
.gitea/workflows/api-change-check.yml
Normal file
62
.gitea/workflows/api-change-check.yml
Normal file
@@ -0,0 +1,62 @@
|
||||
# Gitea Actions:push 后检测 Controller 接口参数变更
|
||||
# 工具代码与配置均位于 .gitea/ 目录,与业务代码解耦
|
||||
|
||||
name: API Parameter Change Check
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
|
||||
jobs:
|
||||
api-param-check:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: 检查配置文件
|
||||
run: |
|
||||
if [ ! -f .gitea/config.yaml ]; then
|
||||
echo "错误: 缺少 .gitea/config.yaml"
|
||||
exit 1
|
||||
fi
|
||||
echo "使用 .gitea/config.yaml"
|
||||
|
||||
- name: 安装 Java 11
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '11'
|
||||
cache: maven
|
||||
|
||||
- name: 安装 Python 3.11
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: 构建 AST 解析器
|
||||
working-directory: .gitea/java-parser
|
||||
run: mvn -q package -DskipTests
|
||||
|
||||
- name: 安装 Python 依赖
|
||||
run: pip install -r .gitea/checker/requirements.txt
|
||||
|
||||
- name: 检测 Controller 接口参数变更
|
||||
run: |
|
||||
python .gitea/checker/main.py \
|
||||
--config .gitea/config.yaml \
|
||||
--repo-root . \
|
||||
"${{ gitea.actor }}" \
|
||||
"$(git log -1 --format=%ci)"
|
||||
|
||||
- name: 上传变更日志
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: api-change-logs
|
||||
path: .gitea/logs/api-changes/
|
||||
if-no-files-found: ignore
|
||||
Reference in New Issue
Block a user