commit
Some checks failed
类变更检测 / class-change-check (push) Failing after 4s

This commit is contained in:
2026-06-05 18:21:45 +08:00
parent c3c73b6fb3
commit ec3bd1d0b2
25 changed files with 1835 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
name: 类变更检测
run-name: ${{ gitea.actor }}的类变更检测
on: [push]
jobs:
class-change-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: 设置 JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
- name: 编译检测工具
run: mvn -q -f .gitea/class-checker/pom.xml package -DskipTests
- name: 执行类变更检测
run: |
OLD_SHA=$(git rev-parse HEAD~1 2>/dev/null || echo "")
if [ -z "$OLD_SHA" ]; then
echo "首次提交,跳过类变更检测"
exit 0
fi
COMMIT_TIME=$(git log -1 --format=%cd --date=format:'%Y-%m-%d %H:%M:%S')
java -jar .gitea/class-checker/target/class-checker.jar \
--config .gitea/config.yaml \
--repo-root . \
--old-sha "$OLD_SHA" \
--new-sha "$(git rev-parse HEAD)" \
--modifier "${{ gitea.actor }}" \
--modify-time "$COMMIT_TIME"