From 3c3a2b7eb67ba618f4cb86eb9d3d5180c22d0096 Mon Sep 17 00:00:00 2001 From: jiri Date: Mon, 15 Jun 2026 06:51:51 +0000 Subject: [PATCH] webhook creation should be added --- scripts/new-dotnet-api-app.sh | 21 +++++++++++++++++++++ scripts/new-dotnet-worker-app.sh | 21 +++++++++++++++++++++ scripts/new-nodejs-ts-app.sh | 21 +++++++++++++++++++++ scripts/new-static-site-app.sh | 21 +++++++++++++++++++++ 4 files changed, 84 insertions(+) diff --git a/scripts/new-dotnet-api-app.sh b/scripts/new-dotnet-api-app.sh index 897c307..43b9662 100755 --- a/scripts/new-dotnet-api-app.sh +++ b/scripts/new-dotnet-api-app.sh @@ -112,6 +112,27 @@ curl -sS -X POST "$GITEA_URL/api/v1/orgs/$GITEA_ORG/repos" \ -H "Content-Type: application/json" \ -d "{\"name\":\"$APP_ID\",\"private\":false,\"auto_init\":false}" >/dev/null || true +echo "Creating Gitea webhook..." + +curl -sS -X POST \ + "$GITEA_URL/api/v1/repos/$GITEA_ORG/$APP_ID/hooks" \ + -H "Authorization: token $GITEA_TOKEN" \ + -H "Content-Type: application/json" \ + -d "{ + \"type\": \"gitea\", + \"active\": true, + \"events\": [\"push\"], + \"config\": { + \"url\": \"$WEBHOOK_INTERNAL_URL\", + \"content_type\": \"json\", + \"secret\": \"$WEBHOOK_SECRET\" + } + }" > /tmp/appfactory-create-hook-response.json + +if grep -q '"message"' /tmp/appfactory-create-hook-response.json; then + cat /tmp/appfactory-create-hook-response.json +fi + if [[ "$GITEA_URL" == http://* ]]; then GITEA_PUSH_URL="${GITEA_URL/http:\/\//http:\/\/${GITEA_TOKEN}@}" elif [[ "$GITEA_URL" == https://* ]]; then diff --git a/scripts/new-dotnet-worker-app.sh b/scripts/new-dotnet-worker-app.sh index fae09c2..3157893 100755 --- a/scripts/new-dotnet-worker-app.sh +++ b/scripts/new-dotnet-worker-app.sh @@ -162,6 +162,27 @@ curl -sS -X POST "$GITEA_URL/api/v1/orgs/$GITEA_ORG/repos" \ -H "Content-Type: application/json" \ -d "{\"name\":\"$APP_ID\",\"private\":false,\"auto_init\":false}" >/dev/null || true +echo "Creating Gitea webhook..." + +curl -sS -X POST \ + "$GITEA_URL/api/v1/repos/$GITEA_ORG/$APP_ID/hooks" \ + -H "Authorization: token $GITEA_TOKEN" \ + -H "Content-Type: application/json" \ + -d "{ + \"type\": \"gitea\", + \"active\": true, + \"events\": [\"push\"], + \"config\": { + \"url\": \"$WEBHOOK_INTERNAL_URL\", + \"content_type\": \"json\", + \"secret\": \"$WEBHOOK_SECRET\" + } + }" > /tmp/appfactory-create-hook-response.json + +if grep -q '"message"' /tmp/appfactory-create-hook-response.json; then + cat /tmp/appfactory-create-hook-response.json +fi + if [[ "$GITEA_URL" == http://* ]]; then GITEA_PUSH_URL="${GITEA_URL/http:\/\//http:\/\/${GITEA_TOKEN}@}" elif [[ "$GITEA_URL" == https://* ]]; then diff --git a/scripts/new-nodejs-ts-app.sh b/scripts/new-nodejs-ts-app.sh index 8d331a0..e81e030 100755 --- a/scripts/new-nodejs-ts-app.sh +++ b/scripts/new-nodejs-ts-app.sh @@ -133,6 +133,27 @@ curl -sS -X POST "$GITEA_URL/api/v1/orgs/$GITEA_ORG/repos" \ -H "Content-Type: application/json" \ -d "{\"name\":\"$APP_ID\",\"private\":false,\"auto_init\":false}" >/dev/null || true +echo "Creating Gitea webhook..." + +curl -sS -X POST \ + "$GITEA_URL/api/v1/repos/$GITEA_ORG/$APP_ID/hooks" \ + -H "Authorization: token $GITEA_TOKEN" \ + -H "Content-Type: application/json" \ + -d "{ + \"type\": \"gitea\", + \"active\": true, + \"events\": [\"push\"], + \"config\": { + \"url\": \"$WEBHOOK_INTERNAL_URL\", + \"content_type\": \"json\", + \"secret\": \"$WEBHOOK_SECRET\" + } + }" > /tmp/appfactory-create-hook-response.json + +if grep -q '"message"' /tmp/appfactory-create-hook-response.json; then + cat /tmp/appfactory-create-hook-response.json +fi + if [[ "$GITEA_URL" == http://* ]]; then GITEA_PUSH_URL="${GITEA_URL/http:\/\//http:\/\/${GITEA_TOKEN}@}" elif [[ "$GITEA_URL" == https://* ]]; then diff --git a/scripts/new-static-site-app.sh b/scripts/new-static-site-app.sh index 06c7cc2..b65e901 100755 --- a/scripts/new-static-site-app.sh +++ b/scripts/new-static-site-app.sh @@ -88,6 +88,27 @@ curl -sS -X POST "$GITEA_URL/api/v1/orgs/$GITEA_ORG/repos" \ -H "Content-Type: application/json" \ -d "{\"name\":\"$APP_ID\",\"private\":false,\"auto_init\":false}" >/dev/null || true +echo "Creating Gitea webhook..." + +curl -sS -X POST \ + "$GITEA_URL/api/v1/repos/$GITEA_ORG/$APP_ID/hooks" \ + -H "Authorization: token $GITEA_TOKEN" \ + -H "Content-Type: application/json" \ + -d "{ + \"type\": \"gitea\", + \"active\": true, + \"events\": [\"push\"], + \"config\": { + \"url\": \"$WEBHOOK_INTERNAL_URL\", + \"content_type\": \"json\", + \"secret\": \"$WEBHOOK_SECRET\" + } + }" > /tmp/appfactory-create-hook-response.json + +if grep -q '"message"' /tmp/appfactory-create-hook-response.json; then + cat /tmp/appfactory-create-hook-response.json +fi + if [[ "$GITEA_URL" == http://* ]]; then GITEA_PUSH_URL="${GITEA_URL/http:\/\//http:\/\/${GITEA_TOKEN}@}" elif [[ "$GITEA_URL" == https://* ]]; then