Refactor GitHub automation tool:
- Updated WorkItemFieldExtractor to be more generic and removed Azure DevOps specific references. - Removed the EnhancedContentBuilders class as it was specific to Azure DevOps. - Deleted work_item_processor.py as it was no longer needed. - Introduced workflow.py to manage GitHub workflow items (issues and pull requests) with improved structure and functionality. - Enhanced logging and error handling across the new workflow management system.
This commit is contained in:
@@ -17,8 +17,6 @@ class ConfigManager:
|
||||
def _get_default_config(self) -> Dict[str, Any]:
|
||||
"""Get default configuration values"""
|
||||
return {
|
||||
'AZURE_DEVOPS_QUERY': None,
|
||||
'AZURE_DEVOPS_PAT': None,
|
||||
'GITHUB_PAT': None,
|
||||
'GITHUB_REPO': None,
|
||||
'FORKED_REPO': None, # User's fork repository
|
||||
@@ -26,13 +24,11 @@ class ConfigManager:
|
||||
'CLAUDE_API_KEY': None,
|
||||
'OPENAI_API_KEY': None,
|
||||
'GITHUB_TOKEN': None, # For GitHub Copilot AI Provider
|
||||
'OLLAMA_URL': None, # Ollama server URL
|
||||
'OLLAMA_API_KEY': None, # Optional Ollama API key/password
|
||||
'OLLAMA_MODEL': None, # Selected Ollama model
|
||||
'LOCAL_REPO_PATH': None,
|
||||
'DRY_RUN': 'false',
|
||||
'DATAVERSE_ENVIRONMENT_URL': None,
|
||||
'DATAVERSE_TABLE_NAME': None,
|
||||
'AZURE_AD_CLIENT_ID': None,
|
||||
'AZURE_AD_CLIENT_SECRET': None,
|
||||
'AZURE_AD_TENANT_ID': None,
|
||||
'CUSTOM_INSTRUCTIONS': None # Custom AI instructions
|
||||
}
|
||||
|
||||
@@ -120,14 +116,10 @@ class ConfigManager:
|
||||
def _create_default_env_file(self, config: Dict[str, Any]) -> None:
|
||||
"""Create a default .env file with empty values"""
|
||||
try:
|
||||
env_template = """# Azure DevOps to GitHub Tool Configuration
|
||||
env_template = """# GitHub Pulse Configuration
|
||||
# Generated automatically - fill in your values
|
||||
# IMPORTANT: Do NOT commit this file to source control. Add it to .gitignore.
|
||||
|
||||
# Azure DevOps Configuration
|
||||
AZURE_DEVOPS_QUERY=
|
||||
AZURE_DEVOPS_PAT=
|
||||
|
||||
# GitHub Configuration
|
||||
GITHUB_PAT=
|
||||
GITHUB_REPO=
|
||||
@@ -141,24 +133,20 @@ AI_PROVIDER=
|
||||
CLAUDE_API_KEY=
|
||||
OPENAI_API_KEY=
|
||||
GITHUB_TOKEN=
|
||||
OLLAMA_URL=
|
||||
OLLAMA_API_KEY=
|
||||
OLLAMA_MODEL=
|
||||
LOCAL_REPO_PATH=
|
||||
|
||||
# PowerApp/Dataverse Configuration (for UUF items - optional)
|
||||
DATAVERSE_ENVIRONMENT_URL=
|
||||
DATAVERSE_TABLE_NAME=
|
||||
AZURE_AD_CLIENT_ID=
|
||||
AZURE_AD_CLIENT_SECRET=
|
||||
AZURE_AD_TENANT_ID=
|
||||
|
||||
# Custom AI Instructions (optional)
|
||||
CUSTOM_INSTRUCTIONS=
|
||||
"""
|
||||
|
||||
|
||||
with open('.env', 'w', encoding='utf-8') as f:
|
||||
f.write(env_template)
|
||||
|
||||
|
||||
print("Created default .env file with blank values")
|
||||
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error creating default .env file: {e}")
|
||||
|
||||
@@ -179,27 +167,22 @@ CUSTOM_INSTRUCTIONS=
|
||||
|
||||
# Build .env file content
|
||||
env_content = []
|
||||
env_content.append("# Azure DevOps to GitHub Tool Configuration")
|
||||
env_content.append("# GitHub Pulse Configuration")
|
||||
env_content.append("# Generated by Settings Dialog")
|
||||
env_content.append("# IMPORTANT: Do NOT commit this file to source control. Add it to .gitignore.")
|
||||
env_content.append("")
|
||||
|
||||
env_content.append("# Azure DevOps Configuration")
|
||||
env_content.append(f"AZURE_DEVOPS_QUERY={self.config.get('AZURE_DEVOPS_QUERY', '')}")
|
||||
env_content.append(f"AZURE_DEVOPS_PAT={self.config.get('AZURE_DEVOPS_PAT', '')}")
|
||||
env_content.append("")
|
||||
|
||||
|
||||
env_content.append("# GitHub Configuration")
|
||||
env_content.append(f"GITHUB_PAT={self.config.get('GITHUB_PAT', '')}")
|
||||
env_content.append(f"GITHUB_REPO={self.config.get('GITHUB_REPO', '')}")
|
||||
env_content.append(f"FORKED_REPO={self.config.get('FORKED_REPO', '')}")
|
||||
env_content.append("")
|
||||
|
||||
|
||||
env_content.append("# Application Settings")
|
||||
dry_run_value = str(self.config.get('DRY_RUN', 'false')).lower()
|
||||
env_content.append(f"DRY_RUN={dry_run_value}")
|
||||
env_content.append("")
|
||||
|
||||
|
||||
env_content.append("# AI Provider Configuration (for local PR creation with AI assistance)")
|
||||
ai_provider_value = self.config.get('AI_PROVIDER', '')
|
||||
print(f"DEBUG: Writing AI_PROVIDER to file: '{ai_provider_value}'")
|
||||
@@ -207,17 +190,12 @@ CUSTOM_INSTRUCTIONS=
|
||||
env_content.append(f"CLAUDE_API_KEY={self.config.get('CLAUDE_API_KEY', '')}")
|
||||
env_content.append(f"OPENAI_API_KEY={self.config.get('OPENAI_API_KEY', '')}")
|
||||
env_content.append(f"GITHUB_TOKEN={self.config.get('GITHUB_TOKEN', '')}")
|
||||
env_content.append(f"OLLAMA_URL={self.config.get('OLLAMA_URL', '')}")
|
||||
env_content.append(f"OLLAMA_API_KEY={self.config.get('OLLAMA_API_KEY', '')}")
|
||||
env_content.append(f"OLLAMA_MODEL={self.config.get('OLLAMA_MODEL', '')}")
|
||||
env_content.append(f"LOCAL_REPO_PATH={self.config.get('LOCAL_REPO_PATH', '')}")
|
||||
env_content.append("")
|
||||
|
||||
env_content.append("# PowerApp/Dataverse Configuration (for UUF items - optional)")
|
||||
env_content.append(f"DATAVERSE_ENVIRONMENT_URL={self.config.get('DATAVERSE_ENVIRONMENT_URL', '')}")
|
||||
env_content.append(f"DATAVERSE_TABLE_NAME={self.config.get('DATAVERSE_TABLE_NAME', '')}")
|
||||
env_content.append(f"AZURE_AD_CLIENT_ID={self.config.get('AZURE_AD_CLIENT_ID', '')}")
|
||||
env_content.append(f"AZURE_AD_CLIENT_SECRET={self.config.get('AZURE_AD_CLIENT_SECRET', '')}")
|
||||
env_content.append(f"AZURE_AD_TENANT_ID={self.config.get('AZURE_AD_TENANT_ID', '')}")
|
||||
env_content.append("")
|
||||
|
||||
|
||||
env_content.append("# Custom AI Instructions (optional)")
|
||||
env_content.append(f"CUSTOM_INSTRUCTIONS={self.config.get('CUSTOM_INSTRUCTIONS', '')}")
|
||||
env_content.append("")
|
||||
|
||||
Reference in New Issue
Block a user