From bcc07b33fc8b6de71b5b1577e084911bbd4cfe8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikael=20West=C3=B6=C3=B6?= Date: Sat, 24 Jan 2026 08:59:10 +0100 Subject: [PATCH] Add GITEA_API_TOKEN to deployment API for private repo access MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SAAC API now receives user's GITEA_API_TOKEN to enable Coolify to clone private repositories. Changes: - Added early validation of GITEA_API_TOKEN (before app creation) - Pass git_token parameter to SAAC API in application creation request - Removed duplicate GITEA_API_TOKEN check in webhook section - Updated error message to explain both use cases (cloning + webhooks) The SAAC API will use this token to configure Coolify with authenticated git access: https://${GITEA_API_TOKEN}@git.startanaicompany.com/${user}/${repo}.git This enables automatic deployments for private repositories. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- deploy-to-apps.example.sh | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/deploy-to-apps.example.sh b/deploy-to-apps.example.sh index 9ebb94d..2e1b019 100644 --- a/deploy-to-apps.example.sh +++ b/deploy-to-apps.example.sh @@ -40,6 +40,22 @@ if [ -z "$SAAC_API_KEY" ]; then exit 1 fi +if [ -z "$GITEA_API_TOKEN" ]; then + echo "❌ Error: GITEA_API_TOKEN environment variable not set" + echo "" + echo "GITEA_API_TOKEN is required for:" + echo " - Cloning your private repository" + echo " - Setting up automatic deployment webhooks" + echo "" + echo "To get your Gitea API token:" + echo "1. Go to https://git.startanaicompany.com" + echo "2. Click your profile → Settings → Applications" + echo "3. Generate New Token (grant 'repo' permissions)" + echo "4. Export it: export GITEA_API_TOKEN='your_token_here'" + echo "" + exit 1 +fi + # Check required .env variables if [ -z "$COMPANY_NAME" ]; then echo "❌ Error: COMPANY_NAME not set in .env" @@ -90,6 +106,7 @@ APP_RESPONSE=$(curl -s -X POST "${SAAC_API}/applications" \ \"domain_suffix\": \"recruit.startanaicompany.com\", \"git_repository\": \"${REPO_URL}\", \"git_branch\": \"master\", + \"git_token\": \"${GITEA_API_TOKEN}\", \"template_type\": \"recruitment\", \"environment_variables\": { \"COMPANY_NAME\": \"${COMPANY_NAME}\", @@ -130,20 +147,6 @@ echo "" # Configure webhook for automatic deployments echo "🪝 Setting up deployment webhook..." -if [ -z "$GITEA_API_TOKEN" ]; then - echo "❌ Error: GITEA_API_TOKEN environment variable not set" - echo "" - echo "Automatic deployments require GITEA_API_TOKEN to set up webhooks." - echo "" - echo "To get your Gitea API token:" - echo "1. Go to https://git.startanaicompany.com" - echo "2. Click your profile → Settings → Applications" - echo "3. Generate New Token (grant 'repo' permissions)" - echo "4. Export it: export GITEA_API_TOKEN='your_token_here'" - echo "" - exit 1 -fi - # Create webhook in Gitea GITEA_API="https://git.startanaicompany.com/api/v1" WEBHOOK_RESPONSE=$(curl -s -X POST "${GITEA_API}/repos/${GITEA_USERNAME}/${GITEA_REPO_NAME}/hooks" \