File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed
Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff 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
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
You can’t perform that action at this time.
0 commit comments