Sync PR head with microsoft/typespec main before regeneration#47770
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the TypeSpec Python Regenerate Tests GitHub Actions workflow so that, when triggered against a microsoft/typespec pull request URL, it merges microsoft/typespec main into the checked-out PR head before regenerating tests. This ensures the regenerated diff reflects only the PR's own changes relative to current main, rather than also surfacing unrelated emitter changes the PR is merely behind on.
Changes:
- Added a
Sync PR head with microsoft/typespec mainstep gated to PR-sourced runs (typespec_pr_number != ''). - The step idempotently configures an
upstreamremote pointing atmicrosoft/typespec, fetches itsmain, and merges it into the detached PR head checkout. - On merge conflict, it aborts the merge and fails the run with an actionable error message; on success it emits a notice with the resulting short SHA.
ChenxiJiang333
approved these changes
Jun 30, 2026
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.
Summary
When the TypeSpec Python regeneration workflow runs against a
microsoft/typespecpull request URL, it now mergesmicrosoft/typespecmaininto the checked-out PR head before regenerating. This ensures the regenerated diff reflects only the PR's changes on top of currentmain, rather than including changes the PR is simply behind on.Changes
Sync PR head with microsoft/typespec mainstep that runs only for PR-sourced runs (typespec_pr_number != '').microsoft/typespecas anupstreamremote (idempotently viaset-url/add), fetches itsmain, and merges it into the PR head.main, the merge is aborted and the workflow fails with a clear, actionable message instructing the user to update the PR branch and resolve conflicts before re-running.Notes
_typespeccheckout already usesfetch-depth: 0, so the full history is available for a proper merge base.main-sourced runs (push/schedule/maininput).Test