🔒 Repository is read-only – file editing is disabled.

PaganLinux/pagan-web-v2/scripts/post-receive main

18 linii Raw ← Powrót
123456789101112131415161718
#!/bin/bash
# post-receive hook – wywołuje webhook Flask po push do recipes.git
# Instalacja: cp do /var/git/recipes.git/hooks/post-receive && chmod +x
#
# UWAGA: sekret z /etc/pagan/build.conf (root-only), nie z kodu.
# (Hook nie jest obecnie zainstalowany na VPS – patrz README.)

source /etc/pagan/build.conf
SECRET="${PAGAN_WEBHOOK_SECRET:-}"
URL="http://127.0.0.1:8000/build/api/git-hook"

while read oldrev newrev refname; do
    REPO=$(basename "$(pwd)" .git)
    curl -s -X POST "$URL" \
        -H "Content-Type: application/json" \
        -d "{\"secret\":\"$SECRET\",\"repo\":\"$REPO\",\"ref\":\"$refname\"}" \
        -o /dev/null &
done