feat: add server_url input to override auto-detected API server URL
Allows specifying internal routing addresses for Gitea/GitHub API calls (e.g., http://server:3000), addressing container network restrictions when external URLs are not routable.
This commit is contained in:
@@ -18,6 +18,10 @@ inputs:
|
|||||||
description: "Custom API base URL (for OpenAI-compatible providers). Ignored for built-in providers."
|
description: "Custom API base URL (for OpenAI-compatible providers). Ignored for built-in providers."
|
||||||
required: false
|
required: false
|
||||||
default: ""
|
default: ""
|
||||||
|
server_url:
|
||||||
|
description: "Override the Gitea/GitHub server URL used for API calls (e.g. http://server:3000 for internal routing inside the runner). Defaults to the auto-detected server URL."
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
token:
|
token:
|
||||||
description: "Git platform token for posting PR comments"
|
description: "Git platform token for posting PR comments"
|
||||||
required: true
|
required: true
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export PI_API_KEY="${INPUT_API_KEY}"
|
|||||||
export PI_PROVIDER="${INPUT_PROVIDER:-zai}"
|
export PI_PROVIDER="${INPUT_PROVIDER:-zai}"
|
||||||
export PI_MODEL="${INPUT_MODEL:-glm-5.1}"
|
export PI_MODEL="${INPUT_MODEL:-glm-5.1}"
|
||||||
export PI_BASE_URL="${INPUT_BASE_URL:-}"
|
export PI_BASE_URL="${INPUT_BASE_URL:-}"
|
||||||
|
export PI_SERVER_URL="${INPUT_SERVER_URL:-}"
|
||||||
export PI_TOOLS="${INPUT_TOOLS:-read,grep,find,ls}"
|
export PI_TOOLS="${INPUT_TOOLS:-read,grep,find,ls}"
|
||||||
export PI_REVIEW_PROMPT="${INPUT_REVIEW_PROMPT:-}"
|
export PI_REVIEW_PROMPT="${INPUT_REVIEW_PROMPT:-}"
|
||||||
export PI_EXCLUDE="${INPUT_EXCLUDE_PATTERNS:-*.lock package-lock.json yarn.lock pnpm-lock.yaml *.min.js *.min.css *.map}"
|
export PI_EXCLUDE="${INPUT_EXCLUDE_PATTERNS:-*.lock package-lock.json yarn.lock pnpm-lock.yaml *.min.js *.min.css *.map}"
|
||||||
|
|||||||
+6
-1
@@ -86,7 +86,12 @@ REPO="${GITHUB_REPOSITORY:-${GITEA_REPOSITORY:-}}"
|
|||||||
|
|
||||||
# Detect Gitea vs GitHub. Gitea sets $GITHUB_SERVER_URL too, so the only
|
# Detect Gitea vs GitHub. Gitea sets $GITHUB_SERVER_URL too, so the only
|
||||||
# reliable signal is $GITEA_ACTIONS (or a non-github.com server URL).
|
# reliable signal is $GITEA_ACTIONS (or a non-github.com server URL).
|
||||||
SERVER_URL="${GITHUB_SERVER_URL:-${GITEA_SERVER_URL:-}}"
|
#
|
||||||
|
# $PI_SERVER_URL (server_url input) overrides the auto-detected server URL.
|
||||||
|
# Gitea reports its *external* hostname (e.g. git.example.com), which may not
|
||||||
|
# be routable from inside the runner's container network. Setting server_url
|
||||||
|
# to the internal address (e.g. http://server:3000) fixes API calls.
|
||||||
|
SERVER_URL="${PI_SERVER_URL:-${GITHUB_SERVER_URL:-${GITEA_SERVER_URL:-}}}"
|
||||||
if [ -n "${GITEA_ACTIONS:-}" ] || { [ -n "$SERVER_URL" ] && [ "${SERVER_URL#*github.com}" = "$SERVER_URL" ]; }; then
|
if [ -n "${GITEA_ACTIONS:-}" ] || { [ -n "$SERVER_URL" ] && [ "${SERVER_URL#*github.com}" = "$SERVER_URL" ]; }; then
|
||||||
API_BASE="${SERVER_URL}/api/v1"
|
API_BASE="${SERVER_URL}/api/v1"
|
||||||
PLATFORM="gitea"
|
PLATFORM="gitea"
|
||||||
|
|||||||
Reference in New Issue
Block a user