Add pr-reviewer module: Gitea webhooks, Spring AI structured output, quote-checked inline comments, de-duplication across pushes and live tests against Gitea 1.27.3 on Spring AI 2.1.0
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b4HkWoC7hLzk61vZa8
This commit is contained in:
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
# What a Gitea with default settings does with a webhook to a private address. Writes output/19.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
IMAGE=${GITEA_IMAGE:-gitea/gitea:1.27.3}
|
||||
NAME=pr-reviewer-gitea-defaults
|
||||
trap 'docker rm -f $NAME >/dev/null' EXIT
|
||||
docker run -d --name $NAME -p 127.0.0.1:3121:3000 -e GITEA__security__INSTALL_LOCK=true -e GITEA__database__DB_TYPE=sqlite3 "$IMAGE" >/dev/null
|
||||
API=http://127.0.0.1:3121/api/v1
|
||||
until curl -sf --noproxy '*' $API/version >/dev/null; do sleep 2; done
|
||||
docker exec -u git $NAME gitea admin user create --username dev --password "Local-$RANDOM$RANDOM$RANDOM" --email [email protected] --admin --must-change-password=false >/dev/null
|
||||
TOKEN=$(docker exec -u git $NAME gitea admin user generate-access-token --username dev --scopes all --token-name t --raw)
|
||||
HOST=$(docker network inspect bridge -f '{{(index .IPAM.Config 0).Gateway}}')
|
||||
post() { curl -s -o /dev/null -w '%{http_code}' --noproxy '*' -H "Authorization: token $TOKEN" -H 'Content-Type: application/json' -d "$2" "$API$1"; }
|
||||
{
|
||||
echo "create repository : $(post /user/repos '{"name":"x","auto_init":true,"default_branch":"main"}')"
|
||||
echo "create webhook : $(post /repos/dev/x/hooks "{\"type\":\"gitea\",\"active\":true,\"events\":[\"pull_request\"],\"config\":{\"url\":\"http://$HOST:8118/webhook/gitea\",\"content_type\":\"json\",\"secret\":\"s\"}}")"
|
||||
echo "push a branch : $(post /repos/dev/x/contents/a.txt '{"content":"YQ==","message":"a","branch":"main","new_branch":"f"}')"
|
||||
echo "open pull request : $(post /repos/dev/x/pulls '{"head":"f","base":"main","title":"t"}')"
|
||||
sleep 8
|
||||
echo
|
||||
echo "Gitea log:"
|
||||
docker logs $NAME 2>&1 | grep 'Unable to deliver' | sed 's/^.*handler() \[E\] //' | tail -1
|
||||
} > output/19-webhook-blocked-by-default.txt
|
||||
cat output/19-webhook-blocked-by-default.txt
|
||||
Reference in New Issue
Block a user