ci: preserve http protocol for internal gitea runner clone
All checks were successful
ESP32 Build & Release / build (push) Successful in 1m17s

This commit is contained in:
2026-09-12 15:28:08 +02:00
parent ba93168af6
commit 15b83e7318

View File

@@ -20,11 +20,12 @@ jobs:
env:
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global init.defaultBranch main
git config --global --add safe.directory "$GITHUB_WORKSPACE"
SERVER_HOST=$(echo "${{ github.server_url }}" | sed -e 's|^https://||' -e 's|^http://||')
CLONE_URL=$(echo "${{ github.server_url }}" | sed -E "s|^(https?://)|\1${GITEA_TOKEN}@|")/${{ github.repository }}.git
git init
git remote add origin "https://${GITEA_TOKEN}@${SERVER_HOST}/${{ github.repository }}.git" || \
git remote set-url origin "https://${GITEA_TOKEN}@${SERVER_HOST}/${{ github.repository }}.git"
git remote add origin "$CLONE_URL" || git remote set-url origin "$CLONE_URL"
git config http.extraheader "AUTHORIZATION: token ${GITEA_TOKEN}"
git fetch --depth 1 origin "${{ github.sha }}" || git fetch --depth 1 origin main
git checkout -f FETCH_HEAD