xanarch-td/tools/init_repo.ps1
2026-06-03 21:53:16 -04:00

29 lines
1 KiB
PowerShell

param(
[Parameter(Mandatory)][string]$ForgejoUrl,
[Parameter(Mandatory)][string]$User,
[Parameter(Mandatory)][string]$Repo
)
$Remote = $ForgejoUrl + '/' + $User + '/' + $Repo + '.git'
Write-Host '==> Initialising git repo' -ForegroundColor Cyan
git init
git add .
git commit -m 'chore: initial scaffold'
Write-Host '==> Pushing main branch' -ForegroundColor Cyan
git branch -M main
git remote add origin $Remote 2>$null
if ($LASTEXITCODE -ne 0) { git remote set-url origin $Remote }
git push -u origin main
Write-Host '==> Creating develop branch' -ForegroundColor Cyan
git checkout -b develop
git push -u origin develop
Write-Host ''
Write-Host 'Done! Next: create labels and milestones:' -ForegroundColor Green
Write-Host (' python tools\forgejo_setup.py --url ' + $ForgejoUrl + ' --token YOUR_TOKEN --owner ' + $User + ' --repo ' + $Repo)
Write-Host ''
Write-Host 'Then set branch protection at:' -ForegroundColor Yellow
Write-Host (' ' + $ForgejoUrl + '/' + $User + '/' + $Repo + '/settings/branches')