Skip to content

Commit

Permalink
(wip) debug
Browse files Browse the repository at this point in the history
  • Loading branch information
pnmadelaine committed Sep 25, 2023
1 parent faf759e commit d6a38e4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/github/githubWebhook.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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" '[]
Expand Down

0 comments on commit d6a38e4

Please sign in to comment.