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