Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/release-winget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,32 @@ jobs:
"$($asset_arm64_url)|arm64|machine" `
"$($asset_arm64_url)|arm64|user"

# Sync the winget-pkgs fork with upstream before submitting,
# to avoid "The forked repository could not be synced with
# the upstream commits" errors from wingetcreate.
# If the fork does not exist yet, wingetcreate will create
# it fresh (and therefore up-to-date), so a 404 is fine.
# See https://docs.github.com/en/rest/branches/branches#sync-a-fork-branch-with-the-upstream-repository
$headers = @{
Authorization = "token $env:WINGET_CREATE_GITHUB_TOKEN"
Accept = "application/vnd.github+json"
}
$user = (Invoke-RestMethod -Uri "https://api.github.com/user" -Headers $headers).login
try {
Invoke-RestMethod -Method Post `
-Uri "https://api.github.com/repos/$user/winget-pkgs/merge-upstream" `
-Headers $headers `
-Body '{"branch":"master"}' `
-ContentType "application/json"
Write-Host "Synced $user/winget-pkgs fork with upstream."
} catch {
if ($_.Exception.Response.StatusCode.value__ -eq 404) {
Write-Host "No fork found at $user/winget-pkgs; wingetcreate will create one."
} else {
throw
}
}

# Submit the manifest to the winget-pkgs repository
$manifestDirectory = "$PWD\manifests\m\Microsoft\Git\$version"
$output = & .\wingetcreate.exe submit $manifestDirectory
Expand Down
Loading