43 lines
1.4 KiB
YAML
43 lines
1.4 KiB
YAML
# Gitea Actions:Controller 接口参数变更检测(纯 Python,无 Java 构建)
|
||
|
||
name: API接口参数变更检测
|
||
run-name: ${{ gitea.actor }}的API参数变更检测
|
||
|
||
on: [push]
|
||
|
||
jobs:
|
||
api-param-check:
|
||
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
|
||
|
||
- name: 安装 Python 和依赖
|
||
run: |
|
||
sudo apt-get update
|
||
sudo apt-get install -y python3 python3-pip
|
||
python3 -m pip install --break-system-packages -r .gitea/checker/requirements.txt
|
||
|
||
- name: 检测 Controller 接口参数变更
|
||
run: |
|
||
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"
|