fix: use token for authentication to support private repos
This commit is contained in:
parent
f066e4bdb1
commit
c17de1d21a
@ -53,10 +53,15 @@ jobs:
|
||||
echo "✅ Gradle configured to use Aliyun mirror"
|
||||
|
||||
- name: Checkout code
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
git config --global --add safe.directory ${{ github.workspace }}
|
||||
git init
|
||||
git remote add origin ${{ github.server_url }}/${{ github.repository }}.git
|
||||
# Use token for authentication (required for private repos)
|
||||
REPO_URL="${{ github.server_url }}/${{ github.repository }}.git"
|
||||
AUTH_URL=$(echo "$REPO_URL" | sed "s|://|://${GITHUB_TOKEN}@|")
|
||||
git remote add origin "$AUTH_URL"
|
||||
git fetch --depth=1 origin ${{ github.sha }}
|
||||
git checkout ${{ github.sha }}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user