forked from foorttesst-oss/github-automation-suite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
119 lines (93 loc) · 2.95 KB
/
setup.py
File metadata and controls
119 lines (93 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/usr/bin/env python3
"""
GitHub Automation Suite Setup Script
Quick configuration for first-time users
"""
import os
import sys
from pathlib import Path
from typing import Dict
def create_env_file():
"""Create .env file with GitHub configuration"""
print("🔧 Setting up GitHub Automation Suite...")
# Get GitHub token
token = input("Enter your GitHub Personal Access Token: ").strip()
if not token:
print("❌ Token is required. Get one from: https://github.com/settings/tokens")
return False
# Get default repository
repo = input("Enter your default repository (owner/repo): ").strip()
if not repo or '/' not in repo:
print("❌ Repository format should be: owner/repo")
return False
# Create .env file
env_content = f"""# GitHub Automation Suite Configuration
GITHUB_TOKEN={token}
GITHUB_REPO={repo}
# Optional: Notification settings
SLACK_WEBHOOK_URL=
DISCORD_WEBHOOK_URL=
EMAIL_NOTIFICATIONS=false
"""
with open('.env', 'w') as f:
f.write(env_content)
print("✅ Configuration saved to .env file")
return True
def create_config_examples():
"""Create example configuration files"""
# PR templates directory
templates_dir = Path('templates')
templates_dir.mkdir(exist_ok=True)
# Feature template
feature_template = """## 🚀 Feature: {{ title }}
### 📋 Summary
{{ description }}
### 🔧 Changes
- {{ changes }}
### 🧪 Testing
- [ ] Unit tests added
- [ ] Integration tests passing
- [ ] Manual testing completed
### 📱 Demo
<!-- Add screenshots or demo links -->
### 🔍 Review Checklist
- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
"""
with open(templates_dir / 'feature.md', 'w') as f:
f.write(feature_template)
print(f"✅ Created PR templates in {templates_dir}/")
def verify_installation():
"""Verify all dependencies are installed"""
try:
import requests
import github
import dotenv
print("✅ All dependencies installed successfully")
return True
except ImportError as e:
print(f"❌ Missing dependency: {e}")
print("Run: pip install -r requirements.txt")
return False
def main():
"""Main setup process"""
print("🚀 GitHub Automation Suite Setup")
print("=" * 40)
# Verify dependencies
if not verify_installation():
return False
# Create configuration
if not create_env_file():
return False
# Create examples
create_config_examples()
print("\n🎉 Setup complete!")
print("\nNext steps:")
print("1. Test with: python auto-pr.py --help")
print("2. Create your first PR: python auto-pr.py --branch feature/test --template feature")
print("3. Check the documentation for advanced features")
return True
if __name__ == '__main__':
success = main()
sys.exit(0 if success else 1)