Fix clone: use GitHub token for auth + DNS retry

This commit is contained in:
Viktor Barzin 2026-02-22 22:49:03 +00:00
parent 3a875c70a7
commit 4e881780d9

View file

@ -5,13 +5,12 @@ when:
clone:
git:
image: alpine
environment:
GITHUB_TOKEN:
from_secret: github-token
commands:
- "apk update && apk add git"
- "printf 'machine %s
login %s
password %s
' \"$CI_NETRC_MACHINE\" \"$CI_NETRC_USERNAME\" \"$CI_NETRC_PASSWORD\" > ~/.netrc && chmod 600 ~/.netrc"
- 'for i in 1 2 3 4 5; do git clone "$CI_REPO_CLONE_URL" . && break || echo "Clone attempt $i failed, retrying in 10s..." && rm -rf .git && sleep 10; done'
- 'for i in 1 2 3 4 5; do git clone https://x-access-token:${GITHUB_TOKEN}@github.com/${CI_REPO} . && break || echo "Clone attempt $i failed, retrying in 10s..." && rm -rf .git && sleep 10; done'
- "git checkout $CI_COMMIT_SHA"
steps: