Refactor spotless-format job and git tagging

Removed output for formatted files in spotless-format job and adjusted git tag handling.
This commit is contained in:
NealDeal34 authored and GitHub committed 2026-01-28 04:44:05 +08:00
1 parent b9cac67ec7
commit 80f7455e7f
1 file changed
+10 -6
+10 -6
View File
@@ -11,8 +11,6 @@ permissions:
jobs:
spotless-format:
runs-on: ubuntu-latest
outputs:
formatted: ${{ steps.spotless.outputs.formatted }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
@@ -27,7 +25,6 @@ jobs:
java-version: '17'
- name: Run spotlessApply
id: spotless
run: |
chmod +x gradlew || true
./gradlew spotlessApply || true
@@ -35,7 +32,6 @@ jobs:
# 检查是否有文件被格式化
if [ -n "$(git status --porcelain)" ]; then
echo "Files were formatted by spotless"
echo "formatted=true" >> $GITHUB_OUTPUT
# 配置 git
git config --local user.email "github-actions[bot]@users.noreply.github.com"
@@ -48,11 +44,19 @@ jobs:
# 更新 tag 指向新的提交
# 获取当前 tag
TAG_NAME=${GITHUB_REF#refs/tags/}
git tag -f "${TAG_NAME}"
# 删除旧的标签(本地和远程)
git tag -d "${TAG_NAME}" || true
git push --delete origin "${TAG_NAME}" || true
# 创建新的标签指向当前提交
git tag "${TAG_NAME}"
# 推送更改和标签
git push origin HEAD:${GITHUB_REF_NAME} --force
git push origin "${TAG_NAME}" --force
else
echo "No files needed formatting"
echo "formatted=false" >> $GITHUB_OUTPUT
fi
release-tags: