-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_github_repo.ps1
More file actions
146 lines (127 loc) · 4.31 KB
/
setup_github_repo.ps1
File metadata and controls
146 lines (127 loc) · 4.31 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# Script to configure GitHub repository settings
# Requires GitHub Personal Access Token with repo permissions
param(
[Parameter(Mandatory=$true)]
[string]$Token,
[Parameter(Mandatory=$false)]
[string]$Owner = "sepehrbayat",
[Parameter(Mandatory=$false)]
[string]$Repo = "simple-chess-opensource"
)
$ErrorActionPreference = "Stop"
Write-Host "🚀 Configuring GitHub repository settings..." -ForegroundColor Cyan
Write-Host ""
$baseUrl = "https://api.github.com/repos/$Owner/$Repo"
$headers = @{
"Authorization" = "token $Token"
"Accept" = "application/vnd.github.v3+json"
"User-Agent" = "PowerShell"
}
# 1. Update repository description
Write-Host "📝 Setting repository description..." -ForegroundColor Yellow
$description = "A complete open-source chess game with AI opponent, move evaluation, and beautiful UI. Built with Python and Pygame."
$body = @{
description = $description
homepage = ""
private = $false
has_issues = $true
has_projects = $true
has_wiki = $false
has_discussions = $true
} | ConvertTo-Json
try {
$response = Invoke-RestMethod -Uri $baseUrl -Method PATCH -Headers $headers -Body $body -ContentType "application/json"
Write-Host "✅ Repository description updated!" -ForegroundColor Green
} catch {
Write-Host "❌ Error updating description: $_" -ForegroundColor Red
Write-Host "Response: $($_.Exception.Response)" -ForegroundColor Red
}
# 2. Add topics
Write-Host ""
Write-Host "🏷️ Adding topics..." -ForegroundColor Yellow
$topics = @(
"chess",
"python",
"pygame",
"game-development",
"minimax",
"alpha-beta-pruning",
"ai",
"artificial-intelligence",
"open-source",
"educational",
"game-engine",
"board-game",
"chess-engine",
"python-game",
"pygame-tutorial"
)
$topicsBody = @{
names = $topics
} | ConvertTo-Json
try {
$topicsUrl = "$baseUrl/topics"
$topicsHeaders = @{
"Authorization" = "token $Token"
"Accept" = "application/vnd.github.mercy-preview+json"
"User-Agent" = "PowerShell"
}
$response = Invoke-RestMethod -Uri $topicsUrl -Method PUT -Headers $topicsHeaders -Body $topicsBody -ContentType "application/json"
Write-Host "✅ Topics added successfully!" -ForegroundColor Green
Write-Host " Topics: $($topics -join ', ')" -ForegroundColor Gray
} catch {
Write-Host "❌ Error adding topics: $_" -ForegroundColor Red
if ($_.Exception.Response) {
$reader = New-Object System.IO.StreamReader($_.Exception.Response.GetResponseStream())
$responseBody = $reader.ReadToEnd()
Write-Host "Response: $responseBody" -ForegroundColor Red
}
}
# 3. Create release
Write-Host ""
Write-Host "📦 Creating release v1.0.0..." -ForegroundColor Yellow
$releaseBody = @{
tag_name = "v1.0.0"
name = "Simple Chess v1.0.0 - Initial Release"
body = @"
## 🎉 Initial Release
### Features
- Complete chess game implementation with all standard rules
- AI opponent using minimax algorithm with alpha-beta pruning
- Move quality evaluation system (0-100 scoring)
- Multiple game modes (User vs User, User vs AI, AI vs AI)
- Beautiful UI with high-quality piece rendering
- Comprehensive documentation and setup scripts
### Installation
\`\`\`bash
git clone https://github.com/$Owner/$Repo.git
cd $Repo
python -m venv venv
.\venv\Scripts\Activate.ps1
pip install -r requirements.txt
python main.py
\`\`\`
### Requirements
- Python 3.7+
- Pygame 2.5.0+
Enjoy playing! 🎮♟️
"@
draft = $false
prerelease = $false
} | ConvertTo-Json
try {
$releaseUrl = "$baseUrl/releases"
$response = Invoke-RestMethod -Uri $releaseUrl -Method POST -Headers $headers -Body $releaseBody -ContentType "application/json"
Write-Host "✅ Release v1.0.0 created successfully!" -ForegroundColor Green
Write-Host " Release URL: $($response.html_url)" -ForegroundColor Gray
} catch {
if ($_.Exception.Response.StatusCode -eq 422) {
Write-Host "⚠️ Release v1.0.0 might already exist. Skipping..." -ForegroundColor Yellow
} else {
Write-Host "❌ Error creating release: $_" -ForegroundColor Red
}
}
Write-Host ""
Write-Host "✅ Repository configuration completed!" -ForegroundColor Green
Write-Host "🌐 Repository: https://github.com/$Owner/$Repo" -ForegroundColor Cyan
Write-Host ""