Probe multiple internal and external repository URLs, then fetch the target commit from the first reachable endpoint before running tests. Made-with: Cursor
This commit is contained in:
+24
-2
@@ -10,9 +10,31 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Prepare workspace
|
- name: Checkout source (adaptive)
|
||||||
run: |
|
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
|
test -f go.mod
|
||||||
|
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
|
|||||||
Reference in New Issue
Block a user