Skip to content

Commit c11029b

Browse files
committed
1231231231223
1 parent 584edb5 commit c11029b

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

.github/workflows/create-git-branch-package-on-release.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@ jobs:
2727
uses: actions/checkout@v4
2828
with:
2929
fetch-depth: 0
30-
# submodules: "recursive"
31-
token: ${{ secrets.BOT_TOKEN }} # 使用BOT_TOKEN进行checkout
30+
token: ${{ secrets.BOT_TOKEN }}
3231

3332
- name: Safe submodule initialization
3433
env:
3534
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3635
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
36+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3737
run: |
3838
# 设置GitHub Actions Bot身份
3939
git config --global user.name "github-actions[bot]"
4040
git config --global user.email "github-actions[bot]@users.noreply.github.com"
4141
42-
# 使用gh命令行工具设置git认证
43-
echo "${{ secrets.BOT_TOKEN }}" | gh auth login --with-token
44-
gh auth setup-git
42+
# 使用git凭据帮助器而不是gh auth
43+
git config --global credential.helper store
44+
echo "https://x-access-token:${{ secrets.BOT_TOKEN }}@github.com" > ~/.git-credentials
4545
4646
echo "Checking for submodules..."
4747
if [ -f .gitmodules ]; then
@@ -51,13 +51,9 @@ jobs:
5151
echo "Submodule configuration:"
5252
cat .gitmodules
5353
54-
# 尝试使用gh命令克隆子模块
55-
echo "Cloning submodules with gh CLI..."
56-
git submodule foreach --recursive 'GH_TOKEN=${{ secrets.BOT_TOKEN }} gh repo clone $(git config --get remote.origin.url) .'
57-
58-
# 如果上述方法失败,回退到传统方法
54+
# 使用配置的凭据克隆子模块
5955
git submodule sync --recursive
60-
git -c "credential.helper=!f() { echo username=x-access-token; echo password=${{ secrets.BOT_TOKEN }}; }; f" submodule update --init --force --recursive || {
56+
git submodule update --init --force --recursive || {
6157
echo "Warning: Some submodules failed to initialize, continuing anyway..."
6258
}
6359
else

0 commit comments

Comments
 (0)