API Review: Update ADO for pending API review state#47562
Conversation
5f222d2 to
dce3081
Compare
There was a problem hiding this comment.
Pull request overview
This PR extends the standalone API-review-PR tooling so that opening/closing an API review PR keeps an Azure DevOps work item's pending-review state in sync. The Python script (create_api_review_pr.py) now fetches the package's ADO work item by package name and embeds its id in the PR body sync metadata, replacing the prior find-work-item/version-derivation approach. A new event-driven GitHub Actions workflow plus a Node helper read that metadata and add/remove the PR URL on the work item's Custom.PendingAPIReviews field on PR opened/closed/reopened. The PR is explicitly blocked by a corresponding azure-sdk-tools change that adds the azsdk package get-work-item/update-work-item CLI commands.
Changes:
- Replace
package_work_item_id/find-work-itemlogic withget_package_work_itemusingazsdk package get-work-item --package-name … -o json, and rename the preflight toensure_azsdk_work_item_commands_available. - Add
.github/workflows/manage-pending-api-reviews.yml(pull_request_target+workflow_call) andeng/common/scripts/manage-pending-api-reviews.jsto updateCustom.PendingAPIReviewsfrom PR events. - Substantially expand the README and replace several Python tests (also dropping tests for still-existing architect/azsdk-resolution helpers).
Note:
.github/skills/create-api-review-pr/SKILL.md(not in this PR) still references the oldazsdk package find-work-itemcommand; it likely needs a follow-up update for consistency with the renamed command.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/api_md_workflow/create_api_review_pr.py | Swaps work-item lookup to get-work-item by package name; new PackageWorkItem dataclass and preflight rename. Bare "azsdk" call is inconsistent with the rest of the file's executable resolution. |
| scripts/api_md_workflow/create_api_review_pr_test.py | Adds tests for the new functions but removes tests covering still-existing helpers, reducing coverage. |
| eng/common/scripts/manage-pending-api-reviews.js | New Node helper that reads PR body metadata and updates the ADO pending-reviews field; minor naming/fallback nits. |
| .github/workflows/manage-pending-api-reviews.yml | New privileged workflow driving ADO updates from PR events; pull_request_target + untrusted body metadata is a security consideration. |
| scripts/api_md_workflow/README.md | Expanded documentation describing the new flow; consistent with the implemented commands. |
| pull_request_target: | ||
| # Merged pull requests are delivered as the closed action with pull_request.merged == true. | ||
| types: [opened, closed, reopened] |
There was a problem hiding this comment.
@Azure/azure-sdk-eng this seems very legit! Any recommendations on the best way to proceed?
9db8d85 to
f151633
Compare
Blocked by: Azure/azure-sdk-tools#16044
This PR updates the
create_api_review_pr.pyscript so that the review PR registers itself as a pending API review on the ADO work item.It also introduces a Github Action that runs when an API Review PR is closed or opened to update the ADO work item.