forked from claude-did-this/claude-hub
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:
@@ -53,22 +53,22 @@ else
|
|||||||
echo "WARNING: No Claude authentication source found at /home/node/.claude." >&2
|
echo "WARNING: No Claude authentication source found at /home/node/.claude." >&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Configure GitHub authentication
|
# Configure Gitea authentication
|
||||||
if [ -n "${GITHUB_TOKEN}" ]; then
|
if [ -n "${GITEA_TOKEN}" ] && [ -n "${GITEA_API_URL}" ]; then
|
||||||
export GH_TOKEN="${GITHUB_TOKEN}"
|
GIT_HOST=$(echo "${GITEA_API_URL}" | sed -E 's|https?://([^/]+).*|\1|')
|
||||||
echo "${GITHUB_TOKEN}" | sudo -u node gh auth login --with-token
|
echo "Using Gitea token for ${GIT_HOST}" >&2
|
||||||
sudo -u node gh auth setup-git
|
|
||||||
else
|
else
|
||||||
echo "No GitHub token provided, skipping GitHub authentication"
|
echo "No Gitea token provided, skipping Git authentication" >&2
|
||||||
|
GIT_HOST=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Clone the repository as node user
|
# Clone the repository as node user
|
||||||
if [ -n "${GITHUB_TOKEN}" ] && [ -n "${REPO_FULL_NAME}" ]; then
|
if [ -n "${GITEA_TOKEN}" ] && [ -n "${REPO_FULL_NAME}" ] && [ -n "${GIT_HOST}" ]; then
|
||||||
echo "Cloning repository ${REPO_FULL_NAME}..." >&2
|
echo "Cloning repository ${REPO_FULL_NAME} from ${GIT_HOST}..." >&2
|
||||||
sudo -u node git clone "https://x-access-token:${GITHUB_TOKEN}@github.com/${REPO_FULL_NAME}.git" /workspace/repo >&2
|
sudo -u node git clone "https://ClaudeBot:${GITEA_TOKEN}@${GIT_HOST}/${REPO_FULL_NAME}.git" /workspace/repo >&2
|
||||||
cd /workspace/repo
|
cd /workspace/repo
|
||||||
else
|
else
|
||||||
echo "Skipping repository clone - missing GitHub token or repository name" >&2
|
echo "Skipping repository clone - missing token or repository name" >&2
|
||||||
cd /workspace
|
cd /workspace
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -347,6 +347,7 @@ function createEnvironmentVars({
|
|||||||
OPERATION_TYPE: operationType,
|
OPERATION_TYPE: operationType,
|
||||||
COMMAND: fullPrompt,
|
COMMAND: fullPrompt,
|
||||||
GITEA_TOKEN: giteaToken,
|
GITEA_TOKEN: giteaToken,
|
||||||
|
GITEA_API_URL: process.env.GITEA_API_URL ?? '',
|
||||||
ANTHROPIC_API_KEY: secureCredentials.get('ANTHROPIC_API_KEY') ?? '',
|
ANTHROPIC_API_KEY: secureCredentials.get('ANTHROPIC_API_KEY') ?? '',
|
||||||
BOT_USERNAME: process.env.BOT_USERNAME,
|
BOT_USERNAME: process.env.BOT_USERNAME,
|
||||||
BOT_EMAIL: process.env.BOT_EMAIL
|
BOT_EMAIL: process.env.BOT_EMAIL
|
||||||
|
|||||||
Reference in New Issue
Block a user