Live test: point the push webhook at a public host, and check one to Diffinery itself is refused (#109)
#96 refuses webhooks to Diffinery's own host, so the live test's webhook to /healthz got a 422 and every sync's live test failed from then on. Claude-Session: https://claude.ai/code/session_016yhgAu6oKfqes812Yd4qjo Co-authored-by: Claude <noreply@anthropic.com>
Canberk Demirci authored · GitHub committed signed1 parent ebac8b0commit 4cfb3c2a46020fea1dd0e1d08bc69140deb91080Browse files
1 file changed+4−1
modified.github/workflows/live-test.yml+4−1View file
| @@ -158,7 +158,10 @@ | ||
| 158 | 158 | set -euo pipefail |
| 159 | 159 | api() { curl -fsS -X "$1" "$DIFFINERY/api/v3$2" -H "Authorization: Bearer $TOKEN" -H "content-type: application/json" ${3:+--data "$3"}; } |
| 160 | 160 | api POST /user/repos "{\"name\":\"$REPO\",\"private\":true}" >/dev/null |
| 161 | - api POST "/repos/$OWNER/$REPO/hooks" "{\"config\":{\"url\":\"$DIFFINERY/healthz\"},\"events\":[\"push\"]}" >/dev/null | |
| 161 | + # Webhooks may only reach public hosts other than Diffinery itself; the push's delivery goes to example.com. | |
| 162 | + code=$(curl -sS -o /dev/null -w '%{http_code}' -X POST "$DIFFINERY/api/v3/repos/$OWNER/$REPO/hooks" -H "Authorization: Bearer $TOKEN" -H "content-type: application/json" --data "{\"config\":{\"url\":\"$DIFFINERY/healthz\"},\"events\":[\"push\"]}") | |
| 163 | + [ "$code" = 422 ] || { echo "::error::a webhook to Diffinery itself answered $code, not 422"; exit 1; } | |
| 164 | + api POST "/repos/$OWNER/$REPO/hooks" "{\"config\":{\"url\":\"https://example.com/diffinery-live-test\"},\"events\":[\"push\"]}" >/dev/null | |
| 162 | 165 | echo "created $OWNER/$REPO" |
| 163 | 166 | |
| 164 | 167 | - name: Push workflows and an LFS file |