From 1b4845cf41dc72cc34058f3c63cc13d835fb238a Mon Sep 17 00:00:00 2001 From: yeelam-gordon Date: Tue, 11 Aug 2026 13:57:13 +0800 Subject: [PATCH] Sync winget-pkgs fork before submitting manifest The Publish to WinGet workflow failed for v0.2 with 'The forked repository could not be synced with the upstream commits.' wingetcreate can only fast-forward a fork that is not too far behind; between releases the fork had fallen ~11,900 commits behind microsoft/winget-pkgs. Add a best-effort pre-sync step that fast-forwards the token owner's fork via the merge-upstream API before wingetcreate runs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 27d9112c-7ed9-41c4-9dda-5dbef425d66c --- .github/workflows/winget.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/winget.yml b/.github/workflows/winget.yml index c52d8e65f3..8b32d5f736 100644 --- a/.github/workflows/winget.yml +++ b/.github/workflows/winget.yml @@ -15,6 +15,19 @@ jobs: runs-on: windows-latest # Action can only run on Windows if: ${{ !github.event.release.prerelease }} # Only publish stable releases to WinGet steps: + - name: Sync winget-pkgs fork with upstream + continue-on-error: true # wingetcreate also attempts a sync; don't fail the run on a transient API error + env: + GH_TOKEN: ${{ secrets.WINGET_TOKEN }} + run: | + # wingetcreate can only fast-forward a fork that is not too far behind upstream. + # A fork left untouched between releases falls thousands of commits behind and the + # submit step then fails with "The forked repository could not be synced with the + # upstream commits." Sync it up front so wingetcreate always sees a current fork. + $owner = (gh api user --jq '.login') + Write-Host "Syncing $owner/winget-pkgs with microsoft/winget-pkgs..." + gh api -X POST "repos/$owner/winget-pkgs/merge-upstream" -f branch=master + - name: Publish Intelligent Terminal run: | $assets = '${{ toJSON(github.event.release.assets) }}' | ConvertFrom-Json