From 1848e28bede5bf8eba9fc76e2db6d07af95a5662 Mon Sep 17 00:00:00 2001 From: pi-farm Date: Sun, 8 Feb 2026 14:10:43 +0100 Subject: [PATCH] add support for non-github repos --- Dockerfile | 2 +- multi-watch.sh | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index b03d080..93d7bc0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM alpine:latest # Abhängigkeiten installieren -RUN apk add --no-cache bash curl jq msmtp ca-certificates tzdata +RUN apk add --no-cache bash curl jq msmtp ca-certificates tzdata git # Struktur anlegen RUN mkdir /app /config diff --git a/multi-watch.sh b/multi-watch.sh index 6f4c708..0a08fa5 100644 --- a/multi-watch.sh +++ b/multi-watch.sh @@ -69,8 +69,26 @@ EOF NEW_VAL=$(echo "$RESPONSE" | grep -i "docker-content-digest" | awk '{print $2}' | tr -d '\r') [[ -z "$NEW_VAL" ]] && NEW_VAL=$(echo "$RESPONSE" | grep -i "etag" | awk '{print $2}' | tr -d '\r' | tr -d '"') fi - elif [ "$TYPE" == "GITHUB" ]; then - NEW_VAL=$(curl -s "https://api.github.com/repos/${REPO}/branches/${EXTRA}" | jq -r '.commit.sha // empty') + elif [ "$TYPE" == "GITHUB" ] || [ "$TYPE" == "GIT" ]; then + if [[ "$REPO" =~ ^http ]] || [[ "$REPO" == *"."* ]]; then + # FALL: Eigener Git-Server (Gitea, GitLab, etc.) + URL="$REPO" + [[ ! "$URL" =~ ^http ]] && URL="https://$URL" + + echo " 🔍 Frage Git-Remote ab: $URL ($EXTRA)..." + + # GIT_TERMINAL_PROMPT=0 verhindert das Warten auf Passworteingaben + # timeout 15s verhindert das Hängenbleiben bei toten Servern + NEW_VAL=$(GIT_TERMINAL_PROMPT=0 timeout 15s git ls-remote "$URL" "refs/heads/$EXTRA" 2>/dev/null | awk '{print $1}') + + if [ $? -ne 0 ] || [ -z "$NEW_VAL" ]; then + echo " ⚠️ Fehler: Git-Server nicht erreichbar oder Repo privat/geschützt." + continue + fi + else + # FALL: Klassisches GitHub Repo via API + NEW_VAL=$(curl -s --max-time 15 "https://api.github.com/repos/${REPO}/branches/${EXTRA}" | jq -r '.commit.sha // empty') + fi fi if [ -z "$NEW_VAL" ] || [ "$NEW_VAL" == "null" ]; then