mirror of
https://github.com/markwylde/claude-code-gitea-action.git
synced 2026-02-19 18:12:50 +08:00
fix: prioritize GITEA_SERVER_URL over GITHUB_SERVER_URL for custom Gitea instances
- Modified config.ts to check GITEA_SERVER_URL first, then fall back to GITHUB_SERVER_URL - Fixes issue where container-based Gitea instances generate internal URLs in comments - Added comprehensive test suite for URL configuration scenarios - Updated README.md with configuration documentation and examples - Added example workflow file for custom URL setup - Fixed TypeScript configuration to support Node.js globals Resolves issue #4: Enable GITEA_SERVER_URL environment variable override
This commit is contained in:
@@ -7,8 +7,25 @@ function deriveApiUrl(serverUrl: string): string {
|
||||
return `${serverUrl}/api/v1`;
|
||||
}
|
||||
|
||||
export const GITEA_SERVER_URL =
|
||||
process.env.GITHUB_SERVER_URL || "https://github.com";
|
||||
// Get the appropriate server URL, prioritizing GITEA_SERVER_URL for custom Gitea instances
|
||||
function getServerUrl(): string {
|
||||
// First check for GITEA_SERVER_URL (can be set by user)
|
||||
const giteaServerUrl = process.env.GITEA_SERVER_URL;
|
||||
if (giteaServerUrl && giteaServerUrl !== "") {
|
||||
return giteaServerUrl;
|
||||
}
|
||||
|
||||
// Fall back to GITHUB_SERVER_URL (set by Gitea/GitHub Actions environment)
|
||||
const githubServerUrl = process.env.GITHUB_SERVER_URL;
|
||||
if (githubServerUrl && githubServerUrl !== "") {
|
||||
return githubServerUrl;
|
||||
}
|
||||
|
||||
// Default fallback
|
||||
return "https://github.com";
|
||||
}
|
||||
|
||||
export const GITEA_SERVER_URL = getServerUrl();
|
||||
|
||||
export const GITEA_API_URL =
|
||||
process.env.GITEA_API_URL || deriveApiUrl(GITEA_SERVER_URL);
|
||||
|
||||
Reference in New Issue
Block a user