Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -31,16 +31,29 @@ jobs:
|
||||
git --version
|
||||
|
||||
- name: Checkout source (native git)
|
||||
env:
|
||||
CI_GIT_TOKEN: ${{ secrets.CI_GIT_TOKEN }}
|
||||
run: |
|
||||
if [ -z "${CI_GIT_TOKEN:-}" ]; then
|
||||
echo "Missing secret CI_GIT_TOKEN. Add it in repository Actions secrets."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
auth_server="${GITHUB_SERVER_URL#https://}"
|
||||
auth_server="${auth_server#http://}"
|
||||
remote_url="https://oauth2:${CI_GIT_TOKEN}@${auth_server}/${GITHUB_REPOSITORY}.git"
|
||||
|
||||
if [ -n "${GITHUB_WORKSPACE:-}" ]; then
|
||||
cd "$GITHUB_WORKSPACE"
|
||||
fi
|
||||
|
||||
if [ ! -d .git ]; then
|
||||
git init
|
||||
git remote add origin "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
|
||||
fi
|
||||
|
||||
git remote remove origin >/dev/null 2>&1 || true
|
||||
git remote add origin "$remote_url"
|
||||
|
||||
git fetch --depth 1 origin "$GITHUB_SHA"
|
||||
git checkout --force FETCH_HEAD
|
||||
|
||||
|
||||
Reference in New Issue
Block a user