release-winget: sync winget-pkgs fork before submitting#883
Open
dscho wants to merge 1 commit intovfs-2.53.0from
Open
release-winget: sync winget-pkgs fork before submitting#883dscho wants to merge 1 commit intovfs-2.53.0from
dscho wants to merge 1 commit intovfs-2.53.0from
Conversation
The `wingetcreate.exe submit` command uses a GitHub token to fork microsoft/winget-pkgs (if needed) and open a PR with the new manifest. When the fork already exists but is behind upstream, wingetcreate fails with "The forked repository could not be synced with the upstream commits. Sync your fork manually and try again." This happened in https://github.com/microsoft/git/actions/runs/24558034627/job/71799343977 because dscho/winget-pkgs was 21,033 commits behind upstream. Fix this by calling the GitHub REST API's "sync a fork branch with the upstream repository" endpoint before invoking `submit`: POST /repos/{owner}/{repo}/merge-upstream (documented at https://docs.github.com/en/rest/branches/branches#sync-a-fork-branch-with-the-upstream-repository) This is the programmatic equivalent of clicking the "Sync fork" / "Update branch" button in the GitHub web UI. The sync call is wrapped in a try/catch that tolerates a 404 response, because on the very first run there may be no fork yet. In that case `wingetcreate submit` will create the fork fresh (and therefore up-to-date), so a 404 is harmless. Any other error is re-thrown so the workflow still fails visibly. Assisted-by: Claude Opus 4.6 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Member
Author
|
Triggered by https://github.com/microsoft/git/actions/runs/24558034627/attempts/1 (which I re-ran after sync'ing my fork manually). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
wingetcreate.exe submitcommand fails when the winget-pkgs fork is behind upstream, withThe forked repository could not be synced with the upstream commits. This happened in https://github.com/microsoft/git/actions/runs/24558034627/job/71799343977 because dscho/winget-pkgs was 21,033 commits behind.This adds a call to the GitHub REST API's merge-upstream endpoint before
submit, which is the programmatic equivalent of clicking the 'Sync fork' / 'Update branch' button in the GitHub web UI.A 404 (no fork yet) is tolerated, since
wingetcreatewill create a fresh fork in that case.