feat: Add Gitea support to claudecode container

- Pass GITEA_API_URL to container environment
- Update entrypoint to clone from Gitea instead of GitHub
- Extract git host from GITEA_API_URL dynamically

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-23 21:27:36 +01:00
parent 8f55bfac35
commit 752cc3a0fc
2 changed files with 11 additions and 10 deletions

View File

@@ -53,22 +53,22 @@ else
echo "WARNING: No Claude authentication source found at /home/node/.claude." >&2
fi
# Configure GitHub authentication
if [ -n "${GITHUB_TOKEN}" ]; then
export GH_TOKEN="${GITHUB_TOKEN}"
echo "${GITHUB_TOKEN}" | sudo -u node gh auth login --with-token
sudo -u node gh auth setup-git
# Configure Gitea authentication
if [ -n "${GITEA_TOKEN}" ] && [ -n "${GITEA_API_URL}" ]; then
GIT_HOST=$(echo "${GITEA_API_URL}" | sed -E 's|https?://([^/]+).*|\1|')
echo "Using Gitea token for ${GIT_HOST}" >&2
else
echo "No GitHub token provided, skipping GitHub authentication"
echo "No Gitea token provided, skipping Git authentication" >&2
GIT_HOST=""
fi
# Clone the repository as node user
if [ -n "${GITHUB_TOKEN}" ] && [ -n "${REPO_FULL_NAME}" ]; then
echo "Cloning repository ${REPO_FULL_NAME}..." >&2
sudo -u node git clone "https://x-access-token:${GITHUB_TOKEN}@github.com/${REPO_FULL_NAME}.git" /workspace/repo >&2
if [ -n "${GITEA_TOKEN}" ] && [ -n "${REPO_FULL_NAME}" ] && [ -n "${GIT_HOST}" ]; then
echo "Cloning repository ${REPO_FULL_NAME} from ${GIT_HOST}..." >&2
sudo -u node git clone "https://ClaudeBot:${GITEA_TOKEN}@${GIT_HOST}/${REPO_FULL_NAME}.git" /workspace/repo >&2
cd /workspace/repo
else
echo "Skipping repository clone - missing GitHub token or repository name" >&2
echo "Skipping repository clone - missing token or repository name" >&2
cd /workspace
fi

View File

@@ -347,6 +347,7 @@ function createEnvironmentVars({
OPERATION_TYPE: operationType,
COMMAND: fullPrompt,
GITEA_TOKEN: giteaToken,
GITEA_API_URL: process.env.GITEA_API_URL ?? '',
ANTHROPIC_API_KEY: secureCredentials.get('ANTHROPIC_API_KEY') ?? '',
BOT_USERNAME: process.env.BOT_USERNAME,
BOT_EMAIL: process.env.BOT_EMAIL