Add typespec sync GH action workflow to automate emitted code merge#37806
Add typespec sync GH action workflow to automate emitted code merge#37806glharper wants to merge 33 commits into
Conversation
…ions and related types - Add getCredentials and pendingUpload operations to beta evaluators - Add EvaluatorCredentialRequest model type - Add entry_point and image_tag optional fields to CodeBasedEvaluatorDefinition - Add merge_prompt.md script for future three-way TypeSpec merges - Update CHANGELOG.md Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
### Packages impacted by this PR ### Issues associated with this PR ### Describe the problem that is addressed by this PR ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? ### Are there test cases added in this PR? _(If not, why?)_ ### Provide a list of related PRs _(if any)_ ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ ### Checklists - [ ] Added impacted package name to the issue description - [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - [ ] Added a changelog (if necessary)
### Packages impacted by this PR ### Issues associated with this PR ### Describe the problem that is addressed by this PR ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? ### Are there test cases added in this PR? _(If not, why?)_ ### Provide a list of related PRs _(if any)_ ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ ### Checklists - [ ] Added impacted package name to the issue description - [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - [ ] Added a changelog (if necessary)
Added comments to clarify workflow requirements and behavior.
There was a problem hiding this comment.
Pull request overview
This PR introduces automation intended to keep a TypeSpec-based SDK in sync with its upstream spec, while also updating @azure/ai-projects to include newly generated/updated API surface (notably beta evaluators and toolsets) and the associated public exports/changelog.
Changes:
- Added a scheduled + manual GitHub Actions workflow to detect spec repo updates, regenerate the client, and push the result to a target branch.
- Updated
@azure/ai-projectspublic surface to include new models/operation groups (e.g., beta evaluators credentials/pending upload, beta toolsets) and refreshed generated artifacts. - Bumped
@azure/ai-projectsversion and updated the changelog; enabled a previously commented-out streaming test.
Reviewed changes
Copilot reviewed 19 out of 85 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/typespec-sync.yml |
Adds automation to detect spec changes and regenerate/push updated emitted code. |
sdk/ai/ai-projects/package.json |
Version bump; adds generate:client script and a new devDependency. |
sdk/ai/ai-projects/CHANGELOG.md |
Documents new features for the new version. |
sdk/ai/ai-projects/src/index.ts |
Exposes newly added types and beta operation option types from the public entrypoint. |
sdk/ai/ai-projects/src/models/index.ts |
Re-exports new model types related to toolsets/evaluators. |
sdk/ai/ai-projects/src/classic/** |
Adds beta toolsets operation group wiring and new beta evaluator operations. |
sdk/ai/ai-projects/src/api/beta/** |
Adds new beta toolsets operations + options; extends evaluators operations/options. |
sdk/ai/ai-projects/generated/** |
Adds/updates generated client, helpers, and operation-group implementations. |
sdk/ai/ai-projects/review/ai-projects-node.api.md |
Updates API review surface to reflect new exports/types/operations. |
sdk/ai/ai-projects/test/public/agents/bingCustomSearch.spec.ts |
Re-enables the streaming test case by removing the commented-out it( wrapper. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…zure/azure-sdk-for-js into glharper/ai-proj-sync-workflow
Co-authored-by: Deyaa <dealmaha@microsoft.com>
Co-authored-by: Deyaa <dealmaha@microsoft.com>
| API_URL+="&per_page=1" | ||
|
|
||
| echo "Querying: $API_URL" | ||
| RESPONSE=$(curl -sf "$API_URL") |
There was a problem hiding this comment.
GH aggressively rate limits anonymous calls to their APIs so this may fail.
There was a problem hiding this comment.
That's unfortunate for one curl every 24h. What would you suggest?
| fetch-depth: 0 | ||
| persist-credentials: true | ||
|
|
||
| node-version: "20.x" |
There was a problem hiding this comment.
GH Copilot code review told me to make it node v20.
| @@ -0,0 +1,182 @@ | |||
| # Workflow: TypeSpec Sync | |||
There was a problem hiding this comment.
@deyaaeldeen this looks to be scoped to just the ai projects do are there plans to do this for other sdks?
@glharper I'm also curious why we are choosing to use this approach over the usual pipeline we use to create PRs when specs change? cc @raych1
There was a problem hiding this comment.
@deyaaeldeen this looks to be scoped to just the ai projects do are there plans to do this for other sdks?
Not that I am aware of. I am also curious about whether the auto PR pipeline could help here but I am not familiar with it. /cc @MaryGao
There was a problem hiding this comment.
@deyaaeldeen this is the JS pipeline. It's used in both the spec PR and release scenarios.
There was a problem hiding this comment.
@weshaggard This adds the "generate:client" step, where the emitted code is merged with existing custom code. The issue with the "push from TypeSpec repo" approach is that each language has its own approach to dealing with custom code in TypeSpec-based libs, as well as post-emitter steps (dealing with idiosyncratic lang-specific emitter behavior).
There was a problem hiding this comment.
generate:client step runs 'tsp-client update' which is essentially same as the command - 'tsp-client init --update-if-exists' ran in the pipeline.
There was a problem hiding this comment.
Yes, we would use tsp-client update for generation and we would also run a series of necessary commands e.g code build, format, sample publish, code snippet update, customization apply etc. Let us know if there are some commands need to tweak.
Packages impacted by this PR
Issues associated with this PR
Describe the problem that is addressed by this PR
What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen?
Are there test cases added in this PR? (If not, why?)
Provide a list of related PRs (if any)
Command used to generate this PR:**(Applicable only to SDK release request PRs)
Checklists