Sync Etunel role collaboration from release v1.0.1

This commit is contained in:
KeyInfo Bot committed 2026-09-09 11:11:54 +08:00
1 parent 64f9a39909
commit 47b73b8e4b
6 files changed
+24 -17

No files matched your search

+8 -3
View File
@@ -683,10 +683,15 @@ function Get-Clone {
[string]$CloneRoot
)
if ($Source.PSObject.Properties.Name -contains "releaseChannel" -and $Source.releaseChannel) {
if ($Source.releaseChannel -ne "latest-stable" -or $Source.repo -notmatch '^https://github\.com/([\w-]+)/([\w.-]+?)(?:\.git)?$') {
throw "releaseChannel requires latest-stable and a GitHub HTTPS repository"
$provider = "github"
if ($Source.PSObject.Properties.Name -contains "releaseProvider") { $provider = $Source.releaseProvider }
if ($Source.releaseChannel -ne "latest-stable" -or $provider -notin @("github", "gitea") -or $Source.repo -notmatch '^https://([A-Za-z0-9.-]+(?::[0-9]+)?)/([\w-]+)/([\w.-]+?)(?:\.git)?$') {
throw "Stable releases require a GitHub or Gitea HTTPS repository"
}
$release = Invoke-RestMethod -Uri "https://api.github.com/repos/$($Matches[1])/$($Matches[2])/releases/latest" -Headers @{ Accept = "application/vnd.github+json"; "User-Agent" = "skill-market" } -TimeoutSec 30
$repoHost, $owner, $repoName = $Matches[1], $Matches[2], $Matches[3]
if ($provider -eq "github" -and $repoHost -ne "github.com") { throw "GitHub releases require github.com; specify releaseProvider for Gitea" }
$apiRoot = if ($provider -eq "github") { "https://api.github.com" } else { "https://$repoHost/api/v1" }
$release = Invoke-RestMethod -Uri "$apiRoot/repos/$owner/$repoName/releases/latest" -Headers @{ Accept = "application/json"; "User-Agent" = "skill-market" } -TimeoutSec 30
$tag = [string]$release.tag_name
if ($release.draft -or $release.prerelease -or $tag -notmatch '^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$') {
throw "Invalid stable release tag: $tag"