Add Gitea integration for Telegram work mode
This commit is contained in:
13
scripts/gitea-askpass.sh
Normal file
13
scripts/gitea-askpass.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
prompt="${1:-}"
|
||||
|
||||
case "$prompt" in
|
||||
*Username*|*username*)
|
||||
printf '%s\n' "${GITEA_USERNAME:-git}"
|
||||
;;
|
||||
*)
|
||||
printf '%s\n' "${GITEA_TOKEN:-}"
|
||||
;;
|
||||
esac
|
||||
@@ -9,6 +9,7 @@ CODEX_APP_SERVER_ENABLED="${CODEX_APP_SERVER_ENABLED:-true}"
|
||||
CODEX_APP_SERVER_CWD="${CODEX_APP_SERVER_CWD:-$BOT_WORKSPACE_ROOT}"
|
||||
CODEX_APP_SERVER_SANDBOX="${CODEX_APP_SERVER_SANDBOX:-${CODEX_READONLY_SANDBOX:-read-only}}"
|
||||
CODEX_APP_SERVER_APPROVAL_POLICY="${CODEX_APP_SERVER_APPROVAL_POLICY:-never}"
|
||||
GITEA_GIT_AUTH_ENABLED="${GITEA_GIT_AUTH_ENABLED:-true}"
|
||||
|
||||
APP_SERVER_PID=""
|
||||
|
||||
@@ -22,6 +23,18 @@ cleanup() {
|
||||
trap cleanup INT TERM EXIT
|
||||
|
||||
mkdir -p /app/data "$BOT_WORKSPACE_ROOT" "${CODEX_HOME:-/root/.codex}"
|
||||
|
||||
if [ "$GITEA_GIT_AUTH_ENABLED" = "true" ] && [ -n "${GITEA_TOKEN:-}" ]; then
|
||||
export GIT_ASKPASS="/app/scripts/gitea-askpass.sh"
|
||||
export GIT_TERMINAL_PROMPT=0
|
||||
if [ -n "${GITEA_USERNAME:-}" ]; then
|
||||
git config --global user.name "$GITEA_USERNAME" || true
|
||||
fi
|
||||
if [ -n "${GITEA_EMAIL:-}" ]; then
|
||||
git config --global user.email "$GITEA_EMAIL" || true
|
||||
fi
|
||||
fi
|
||||
|
||||
python -m app.ensure_codex_config
|
||||
|
||||
if [ "$CODEX_APP_SERVER_ENABLED" = "true" ]; then
|
||||
|
||||
Reference in New Issue
Block a user