- Add agent configuration files (AGENTS.md, USER.md, IDENTITY.md, SOUL.md) - Add git configuration and skills management scripts - Add frontend/backend analysis tools and reports - Add DingTalk media sender utilities and documentation - Fix OpenClaw runtime environment (Node.js and Python) - Configure git remotes and push scripts
85 lines
3.1 KiB
PowerShell
85 lines
3.1 KiB
PowerShell
# Gitea Repository Creation Script
|
|
|
|
$GIT_SERVER = "git.alicorns.co.jp"
|
|
$GIT_USER = "aitest"
|
|
$GIT_PASSWORD = "Aitest123456"
|
|
|
|
Write-Host "=== Gitea API Repository Creation ===" -ForegroundColor Green
|
|
Write-Host ""
|
|
|
|
# Gitea API endpoints
|
|
$apiBase = "https://$GIT_SERVER/api/v1"
|
|
$createRepoUrl = "$apiBase/user/repos"
|
|
|
|
Write-Host "Gitea Server: $GIT_SERVER" -ForegroundColor Cyan
|
|
Write-Host "API Base: $apiBase" -ForegroundColor Cyan
|
|
Write-Host "Create Repo URL: $createRepoUrl" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
# Create authentication header
|
|
$authHeader = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$GIT_USER`:$GIT_PASSWORD"))
|
|
$headers = @{
|
|
"Authorization" = "Basic $authHeader"
|
|
"Content-Type" = "application/json"
|
|
}
|
|
|
|
# Test Gitea API connection
|
|
Write-Host "Testing Gitea API connection..." -ForegroundColor Yellow
|
|
try {
|
|
$response = Invoke-WebRequest -Uri "$apiBase/user" -Headers $headers -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop
|
|
$userInfo = $response.Content | ConvertFrom-Json
|
|
Write-Host "[SUCCESS] Connected to Gitea" -ForegroundColor Green
|
|
Write-Host "User: $($userInfo.login)" -ForegroundColor Cyan
|
|
Write-Host "Full Name: $($userInfo.full_name)" -ForegroundColor Cyan
|
|
} catch {
|
|
Write-Host "[FAILED] Cannot connect to Gitea API: $($_.Exception.Message)" -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
|
|
Write-Host ""
|
|
|
|
# Create repositories
|
|
$repositories = @(
|
|
@{Name = "office-file-handler"; Description = "OpenClaw skill for Office file handling"},
|
|
@{Name = "dingtalk-media-sender"; Description = "OpenClaw skill for DingTalk media sending"}
|
|
)
|
|
|
|
foreach ($repo in $repositories) {
|
|
Write-Host "=== Creating repository: $($repo.Name) ===" -ForegroundColor Cyan
|
|
|
|
$repoData = @{
|
|
name = $repo.Name
|
|
description = $repo.Description
|
|
private = $true
|
|
auto_init = $false
|
|
readme = "none"
|
|
} | ConvertTo-Json
|
|
|
|
try {
|
|
$response = Invoke-WebRequest -Uri $createRepoUrl -Headers $headers -Method Post -Body $repoData -UseBasicParsing -ErrorAction Stop
|
|
$result = $response.Content | ConvertFrom-Json
|
|
|
|
if ($response.StatusCode -eq 201 -or $response.StatusCode -eq 200) {
|
|
Write-Host "[SUCCESS] Repository created!" -ForegroundColor Green
|
|
Write-Host "Name: $($result.name)" -ForegroundColor Cyan
|
|
Write-Host "URL: $($result.clone_url)" -ForegroundColor Cyan
|
|
Write-Host "SSH URL: $($result.ssh_url)" -ForegroundColor Cyan
|
|
} else {
|
|
Write-Host "[INFO] Repository result: $($response.StatusCode)" -ForegroundColor Yellow
|
|
}
|
|
} catch {
|
|
if ($_.Exception.Message -match "already exists") {
|
|
Write-Host "[INFO] Repository already exists" -ForegroundColor Yellow
|
|
} else {
|
|
Write-Host "[FAILED] Creation failed: $($_.Exception.Message)" -ForegroundColor Red
|
|
Write-Host "Response: $($_.Exception.Response)" -ForegroundColor Red
|
|
}
|
|
}
|
|
|
|
Write-Host ""
|
|
}
|
|
|
|
Write-Host "=== Repository Creation Complete ===" -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host "Now you can push your code!" -ForegroundColor Yellow
|