AkurAI Build
Menu

Public repository / 8d41f1e10aceed387d425b43038f2070e399a349

AkurAI-Build / deploy/hooks/post-receive

Latest change 3367b5f4b77e4085d5cc513b20e67403d2207543 - OLI-272: outbound webhooks with HMAC signatures, delivery log and redelivery; git Basic challenge by Óli

#!/bin/sh
# Installed by AkurAI Build into every hosted repository (hooks/post-receive).
# Tells the forge about each ref update so outbound webhooks fire (OLI-272).
# Only pushes through the forge's Smart HTTP endpoint carry the forge env.
[ -n "${AKURAI_FORGE_URL:-}" ] && [ -n "${AKURAI_FORGE_TOKEN:-}" ] && [ -n "${AKURAI_FORGE_REPO:-}" ] || exit 0
while read -r old new ref; do
  body=$(printf '{"reference":"%s","before":"%s","after":"%s","pusher":"%s"}' "$ref" "$old" "$new" "${REMOTE_USER:-}")
  curl -s -m 10 -o /dev/null -X POST "$AKURAI_FORGE_URL/api/repos/$AKURAI_FORGE_REPO/events/push" \
    -H "Authorization: Bearer $AKURAI_FORGE_TOKEN" -H 'Content-Type: application/json' --data "$body" </dev/null || true
done
exit 0