36ccfc9471
Replace git.kalinamall.ru links with github.com/PTah in public docs. Add Rewrite-GitHostUrls.ps1 and Push-Mirror.ps1 for kalinamall mirror pushes. Add .cursor/ to .gitignore. Co-authored-by: Cursor <cursoragent@cursor.com>
42 lines
1.1 KiB
PowerShell
42 lines
1.1 KiB
PowerShell
# Push main to a mirror remote with host-specific doc URLs, without leaving URL churn on main.
|
|
# Usage: .\scripts\Push-Mirror.ps1 github|kalinamall|papatramp
|
|
param(
|
|
[Parameter(Mandatory = $true)]
|
|
[ValidateSet('github', 'kalinamall', 'papatramp')]
|
|
[string]$Target
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
$Root = Split-Path -Parent $PSScriptRoot
|
|
Set-Location $Root
|
|
|
|
$remote = switch ($Target) {
|
|
'github' { 'github' }
|
|
'kalinamall' { 'kalinamall' }
|
|
'papatramp' { 'papatramp' }
|
|
}
|
|
|
|
git remote get-url $remote 2>$null | Out-Null
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw "remote not configured: $remote"
|
|
}
|
|
|
|
if ((git status --porcelain)) {
|
|
throw 'working tree not clean; commit or stash first'
|
|
}
|
|
|
|
$before = (git rev-parse HEAD).Trim()
|
|
& "$PSScriptRoot\Rewrite-GitHostUrls.ps1" -Target $Target
|
|
|
|
if (-not (git status --porcelain)) {
|
|
Write-Output "no URL changes for $Target; pushing as-is"
|
|
git push $remote main
|
|
exit 0
|
|
}
|
|
|
|
git add -A
|
|
git commit -m "chore(docs): sync repository URLs for ${Target} mirror"
|
|
git push $remote main
|
|
git reset --hard $before
|
|
Write-Output "pushed $remote with ${Target} URLs; local main reset to $before"
|