feat: Implement automatic git repository configuration detection for Gitea
- Add GiteaConfig.from_git_repository() method for auto-detection - Support HTTP(S) and SSH git remote URL formats - Parse gitea_url, repo_owner, repo_name from git remote origin - Only requires GITEA_API_TOKEN environment variable - Update GiteaClient to use auto-detection as primary method - Maintain backward compatibility with environment variables - Fix issue creation API to use label IDs instead of names - Add comprehensive error handling and validation - Successfully tested with issues #33 and #34 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
ad355f970c
commit
ad25b2a7d7
4 changed files with 221 additions and 6 deletions
|
|
@ -170,10 +170,14 @@ class GiteaClient:
|
|||
"""Initialize Gitea client.
|
||||
|
||||
Args:
|
||||
config: GiteaConfig instance. If None, loads from environment.
|
||||
config: GiteaConfig instance. If None, auto-detects from git repository.
|
||||
"""
|
||||
if config is None:
|
||||
config = GiteaConfig.from_environment()
|
||||
try:
|
||||
config = GiteaConfig.from_git_repository()
|
||||
except Exception:
|
||||
# Fallback to environment-based config if git detection fails
|
||||
config = GiteaConfig.from_environment()
|
||||
config.validate()
|
||||
|
||||
self.config = config
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue