You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Create a GitHub PR for API review by comparing a baseline API surface against a target branch. Use this when the user wants to create an API review PR, compare API changes between versions, or review API surface differences for a package.
3
+
description: Create a GitHub PR for API review by comparing a baseline API surface against a target tag or branch. Use this when the user wants to create an API review PR, compare API changes between versions, or review API surface differences for a package.
4
4
---
5
5
6
6
# Create API Review PR
7
7
8
-
Creates a dedicated API review PR that shows the diff between a baseline release and a target branch's API surface using `scripts/api_md_workflow/create_api_review_pr.js`.
8
+
Creates a dedicated API review PR that shows the diff between a baseline release and a target tag or branch's API surface using `scripts/api_md_workflow/create_api_review_pr.js`.
9
+
10
+
## Unsupported Requests
11
+
12
+
If the user asks to create an API review PR for a new package, explain that new packages do not use API review PRs and stop. Do not gather script inputs or run `create_api_review_pr.js` for new packages.
9
13
10
14
## Prerequisites
11
15
@@ -21,14 +25,14 @@ Ask the user for the following using `vscode_askQuestions`:
21
25
### 1. Package Name (required)
22
26
The Azure SDK package name (e.g. `azure-storage-blob`, `azure-ai-projects`).
23
27
24
-
### 2. Baseline (optional)
28
+
### 2. Baseline (required)
25
29
The release tag to use as the baseline for comparison. Tags follow the format `<package-name>_<version>` (e.g. `azure-storage-blob_12.29.0`).
26
30
27
31
- If the user provides a package name and version separately, construct the tag as `<package-name>_<version>`.
28
-
- If this is a **new package** with no prior release, the baseline should be omitted (the script handles this as an empty baseline).
29
32
30
33
### 3. Target (optional)
31
34
The branch or PR to generate the "current" API surface from. Can be:
35
+
- A package release tag (e.g. `azure-storage-blob_12.30.0`) — used directly as a tag ref
32
36
- A branch name (e.g. `main`, `feature-branch`) — fetched from `origin`
33
37
- An `owner:branch` reference (e.g. `someone:their-branch`) — fetched from the fork
34
38
- If omitted, defaults to `origin/main`
@@ -38,15 +42,20 @@ The branch or PR to generate the "current" API surface from. Can be:
38
42
Before running the script:
39
43
40
44
1.**Validate the package exists**: Confirm a directory matching `sdk/*/<package-name>` exists with a `pyproject.toml` or `setup.py`.
41
-
2.**Validate the baseline tag** (if provided): Run `git tag -l "<tag>"` to confirm the tag exists. If the user provided a version like `12.29.0`, construct the full tag as `<package-name>_<version>` and validate that.
42
-
3.**Confirm the working tree is clean**: Run `git status --porcelain` and warn if there are uncommitted changes.
45
+
2.**Validate the baseline tag**: Run `git tag -l "<tag>"` to confirm the tag exists. If the user provided a version like `12.29.0`, construct the full tag as `<package-name>_<version>` and validate that.
46
+
3.**Validate the target tag when applicable**: If the user provided a target version or tag, construct or validate the full tag as `<package-name>_<version>` and run `git tag -l "<tag>"`.
47
+
4.**Confirm the working tree is clean**: Run `git status --porcelain` and warn if there are uncommitted changes.
43
48
44
49
## Execution
45
50
51
+
This is a long-running operation. The script may take several minutes because it generates API surfaces for both the baseline and target, installs package dependencies, creates or reuses review branches, pushes branches, and then opens the draft PR. Do not treat quiet terminal periods during dependency installation or `apistub` generation as failure unless the command exits, prints an error, or waits for input.
52
+
53
+
If `create_api_review_pr.js` fails while running this skill, do not patch the script, modify package files, retry with workaround edits, or try to manually complete branch/PR creation. Stop the workflow, report the failure clearly, include the relevant error details, and suggest practical next steps.
54
+
46
55
Run the following command from the repository root:
2. Push `base_<package>_<version>` and `review_<package>_<version>` branches
82
+
2. Push `apireview/base_<package>_<version>` and `apireview/review_<package>_<version>` branches
74
83
3. Open a draft PR (or print a compare URL if `gh pr create` fails)
75
84
85
+
During execution, report progress at major phases: baseline generation, target generation, branch creation or reuse, branch push, and PR creation. If the terminal is quiet, check whether the process is still running before assuming it is hung.
86
+
87
+
When the target is a tag, the PR body labels it as `Target tag`. Branch and fork targets are labeled as `Working branch`.
Copy file name to clipboardExpand all lines: scripts/api_md_workflow/README.md
+11-3Lines changed: 11 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ It runs on pull requests for changes under `sdk/**`.
22
22
- Regenerates `api.md` for those packages.
23
23
- Fails if the generated files differ from the committed files.
24
24
- Fails if an affected package does not have a committed `api.md`.
25
-
- Prints the mismatched or missing packages and the `azpysdk apistub --md --extract-metadata <package-name> --dest-dir <package-dir>` command needed to regenerate each `api.md` file.
25
+
- Prints the mismatched or missing packages and the `azpysdk apistub --md --extract-metadata <package-name> --dest-dir .` command needed to regenerate each `api.md` file from the repository root.
26
26
27
27
## Script Layout
28
28
@@ -49,7 +49,7 @@ Also writes `count=<n>` to `GITHUB_OUTPUT`.
49
49
50
50
### `regenerate.js`
51
51
52
-
Reads package directories from `API_MD_PACKAGES_FILE` and runs `azpysdk apistub --md --extract-metadata <package-name> --dest-dir <package-dir>` for each package.
52
+
Reads package directories from `API_MD_PACKAGES_FILE` and runs `azpysdk apistub --md --extract-metadata <package-name> --dest-dir <package-dir>` for each package from the repository root.
53
53
54
54
This script is used by the consistency check.
55
55
@@ -73,6 +73,14 @@ API review PR creation now uses a shared JavaScript orchestrator with a language
73
73
74
74
This split allows the core workflow to be reused across other language repos while keeping generation behavior language-specific.
75
75
76
+
`create_api_review_pr.js` compares a baseline package release tag with a target API surface. The target can be a package release tag, an `origin` branch, or an `owner:branch` fork reference. When the target is a tag, the generated PR body identifies it as a target tag instead of a working branch.
Shared configuration for adapter selection across `api_md_workflow` scripts.
@@ -100,4 +108,4 @@ Common variables include:
100
108
3.`find_affected.js` determines which packages were touched.
101
109
4.`regenerate.js` rebuilds `api.md` for those packages.
102
110
5.`find_mismatches.js` records any `api.md` drift, including missing or untracked `api.md` files.
103
-
6. If drift is found, the workflow fails and prints the affected packages plus the `azpysdk apistub --md --extract-metadata <package-name> --dest-dir <package-dir>` command to regenerate each `api.md` file locally.
111
+
6. If drift is found, the workflow fails and prints the affected packages plus the `azpysdk apistub --md --extract-metadata <package-name> --dest-dir .` command to regenerate each `api.md` file locally from the repository root.
0 commit comments