From 5dce7f5d73eae76797baebee9d8f793a172c1610 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 17 Apr 2026 13:49:09 +0200 Subject: [PATCH] fixup! Adding winget workflows The notice at the end of a successful winget submission says "Submitted v2.53.0.vfs.0.7 to winget as h" instead of printing the full PR URL. This was visible in https://github.com/microsoft/git/actions/runs/24558034627 (run attempt 2, which succeeded after manually syncing the fork). The root cause is a PowerShell quirk: when Select-String produces exactly one match, ForEach-Object { $_.Matches.Value } emits a single string rather than a one-element array. The trailing [0] then indexes into that string, returning its first character "h" (from "https://...") instead of the first array element. PR #843 (which tightened the regex from 'https://\S+' to the full winget-pkgs URL pattern) inherited this [0] from the original code, where $output was an array of lines and [0] picked the first line's match. After the PR #843 change to pass -t via environment variable, wingetcreate's output arrives as a single string, so [0] now indexes into the string itself. Fix by simply dropping the [0], since the tightened regex can only match the one URL we care about anyway. Assisted-by: Claude Opus 4.6 Signed-off-by: Johannes Schindelin --- .github/workflows/release-winget.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-winget.yml b/.github/workflows/release-winget.yml index 42a78fcfe884ee..d1d66a358f3be1 100644 --- a/.github/workflows/release-winget.yml +++ b/.github/workflows/release-winget.yml @@ -80,6 +80,6 @@ jobs: $manifestDirectory = "$PWD\manifests\m\Microsoft\Git\$version" $output = & .\wingetcreate.exe submit $manifestDirectory Write-Host $output - $url = ($output | Select-String -Pattern 'https://github\.com/microsoft/winget-pkgs/pull/\S+' | ForEach-Object { $_.Matches.Value })[0] + $url = $output | Select-String -Pattern 'https://github\.com/microsoft/winget-pkgs/pull/\S+' | ForEach-Object { $_.Matches.Value } Write-Host "::notice::Submitted ${env:TAG_NAME} to winget as $url" shell: powershell