[typespec-python] Add generated test regeneration workflow#46414
Open
iscai-msft wants to merge 4 commits intoAzure:mainfrom
Open
[typespec-python] Add generated test regeneration workflow#46414iscai-msft wants to merge 4 commits intoAzure:mainfrom
iscai-msft wants to merge 4 commits intoAzure:mainfrom
Conversation
Add typespec-python-regen.yml workflow that regenerates Python SDK test code from microsoft/typespec's http-client-python emitter. Outputs both azure and unbranded flavors to eng/tools/typespec-python-generated-tests/. Triggers: - repository_dispatch (from microsoft/typespec on merge) - workflow_dispatch (manual, with configurable ref) Creates an auto-merge PR when regenerated code changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds automation to keep a canonical, regenerated copy of TypeSpec Python emitter-generated test code in this repo, by introducing a GitHub Actions workflow plus documentation for the generated-test directory.
Changes:
- Introduces a new GitHub Actions workflow to regenerate and PR generated tests from
microsoft/typespec’shttp-client-pythonemitter. - Adds documentation describing the purpose, layout, and regeneration path for
eng/tools/typespec-python-generated-tests/.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
eng/tools/typespec-python-generated-tests/README.md |
Documents what the generated tests are and how regeneration is expected to work. |
.github/workflows/typespec-python-regen.yml |
Implements the automated regeneration + PR creation (and auto-merge) workflow. |
Regenerated from microsoft/typespec@fae1a8f (main) - 116 azure flavor packages - 65 unbranded flavor packages Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add dispatch sender validation guard - Use fetch-depth: 0 for reliable PR branch creation - Inline ref expression in checkout to avoid GITHUB_OUTPUT injection - Sanitize ref value before writing to GITHUB_OUTPUT for PR metadata - Make auto-merge conditional on workflow_dispatch only (not repository_dispatch) - Update README with full regeneration steps (install, build, prepare) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
4d93412 to
66d6d35
Compare
- Rename folder: typespec-python-generated-tests -> tsp-python-gen (fixes path length >260 chars) - Rename workflow: typespec-python-regen.yml -> typespec-python-regenerate.yml (fixes cspell 'regen' errors) - Replace 'Regen' with 'Regenerate' in workflow name and dispatch type - Add CODEOWNERS for tsp-python-gen/ and the workflow file Owners: @tadelesh @msyyc @iscai-msft @lmazuel @lirenhe Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Add a GitHub Actions workflow that regenerates Python SDK test code from
microsoft/typespec'shttp-client-pythonemitter and stores the output ineng/tools/typespec-python-generated-tests/.Motivation
The TypeSpec Python emitter (
@typespec/http-client-python) generates test code againsthttp-specsandazure-http-specstest suites. Currently these generated tests aren't tracked anywhere persistent. This workflow keeps a canonical copy in azure-sdk-for-python, updated automatically when the emitter changes.How it works
Triggers
repository_dispatch— automated, triggered from microsoft/typespec when http-client-python merges to mainworkflow_dispatch— manual, with configurabletypespec_ref(branch, tag, SHA, ormainfor latest unreleased code)Steps
npm run regenerateto generate both azure and unbranded flavorseng/tools/typespec-python-generated-tests/{azure,unbranded}/Output structure