ci: Fix git clone with GITHUB_TOKEN for private repo auth
Some checks failed
Build .deb Package / build-and-package (push) Failing after 1s
Some checks failed
Build .deb Package / build-and-package (push) Failing after 1s
- Private repos require authentication for git clone - Inject GITHUB_TOKEN into clone URL: http://echo:{GITHUB_TOKEN}@host/repo.git - Kill stuck clone processes on runner before new build
This commit is contained in:
@ -23,8 +23,11 @@ jobs:
|
||||
|
||||
- name: Checkout repository
|
||||
run: |
|
||||
rm -rf .git
|
||||
git clone "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" .
|
||||
# Use GITHUB_TOKEN for authenticated clone
|
||||
GIT_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
|
||||
# Inject token into URL for private repos
|
||||
AUTH_URL="${GIT_URL/http:\/\//http://echo:${GITHUB_TOKEN}@}"
|
||||
git clone "${AUTH_URL}" .
|
||||
git checkout "$GITHUB_SHA"
|
||||
|
||||
- name: Ensure Rust toolchain
|
||||
|
||||
Reference in New Issue
Block a user