diff --git a/lib/github/githubWebhook.nix b/lib/github/githubWebhook.nix index 5a56e6a1..2ee29106 100644 --- a/lib/github/githubWebhook.nix +++ b/lib/github/githubWebhook.nix @@ -22,11 +22,17 @@ in { body=$(echo "$input" | jq '.input.body' -r) secret=$(echo "$input" | jq '.secrets.github_webhook_secret' -r) + >&2 echo "headers: $headers" + >&2 echo "body: $body" + event=$(echo "$headers" | jq '."X-GitHub-Event"' -r) - [ "$event" == "push" ] || exit 0 + >&2 echo "event: $event" + [ "$event" == "push" ] signatureSent=$(echo "$headers" | jq '."X-Hub-Signature-256"') signatureComputed=$(echo -n "$body" | openssl dgst -sha256 -hmac "$secret" -binary | base64 -w 0) + >&2 echo "signature 1: $signatureSent" + >&2 echo "signature 2: $signatureComputed" [ "$signatureSent" == "$signatureComputed" ] echo null | jq --argjson body "$body" '[]