Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
autoactions committed Dec 23, 2024
1 parent e50214f commit 3e4bc4e
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions .github/workflows/optimize-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 1 # 浅克隆,只获取最新的提交
fetch-depth: 0 # 获取完整历史以确保正确同步
token: ${{ github.token }} # 使用默认的 GITHUB_TOKEN
filter: blob:none # 不下载 Git 对象

- name: Sync with upstream
id: sync
Expand All @@ -40,26 +39,23 @@ jobs:
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
# 添加上游仓库并只获取必要的分支
# 添加上游仓库
git remote add upstream https://github.com/pagefaultgames/pokerogue.git
git config --local remote.upstream.fetch '+refs/heads/main:refs/remotes/upstream/main'
# 获取上游更新(只获取最新的提交)
git fetch --depth=1 upstream main
# 获取上游更新
git fetch upstream main
# 检查是否有更新需要同步
if git rev-list HEAD..upstream/main --count | grep -q "^0$"; then
echo "sync_status=uptodate" >> $GITHUB_OUTPUT
echo "仓库已是最新,无需同步"
else
# 合并上游更新,允许不相关历史
if git merge upstream/main --no-edit --allow-unrelated-histories; then
echo "sync_status=success" >> $GITHUB_OUTPUT
git push
else
echo "sync_status=failed" >> $GITHUB_OUTPUT
exit 1
fi
# 重置到上游状态
git reset --hard upstream/main
# 强制推送更新
git push origin HEAD:test -f
echo "sync_status=success" >> $GITHUB_OUTPUT
fi
- name: Check sync status
Expand Down

0 comments on commit 3e4bc4e

Please sign in to comment.