From 169a486043d9c7ac148cbc19a9149a66a02bb1fc Mon Sep 17 00:00:00 2001 From: Andriy Oblivantsev Date: Sun, 1 Mar 2026 11:50:23 +0000 Subject: [PATCH] Add adaptive checkout strategy for Gitea Actions runners. Probe multiple internal and external repository URLs, then fetch the target commit from the first reachable endpoint before running tests. Made-with: Cursor --- .gitea/workflows/ci.yml | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 8d8f550..4280c53 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -10,9 +10,31 @@ jobs: test: runs-on: ubuntu-latest steps: - - name: Prepare workspace + - name: Checkout source (adaptive) run: | - ls -la + set -euo pipefail + GW="$(ip route | awk '/default/ {print $3; exit}')" + CANDIDATES=" + http://gitea:3000/${{ github.repository }} + http://${GW}:3000/${{ github.repository }} + http://host.docker.internal:3000/${{ github.repository }} + https://git.produktor.io/${{ github.repository }} + https://git.produktor.io/${{ github.repository }}.git + " + REPO_URL="" + for URL in ${CANDIDATES}; do + if git -c http.sslVerify=false ls-remote "${URL}" >/dev/null 2>&1; then + REPO_URL="${URL}" + break + fi + done + test -n "${REPO_URL}" + echo "Using repo URL: ${REPO_URL}" + rm -rf .git + git init . + git remote add origin "${REPO_URL}" + git -c http.sslVerify=false fetch --depth=1 origin "${{ github.sha }}" + git checkout --detach FETCH_HEAD test -f go.mod - name: Setup Go