Skip to content

Python POC for GitHub-based API Reviews (Phase 2)#47443

Open
tjprescott wants to merge 55 commits into
mainfrom
APIReviewSync
Open

Python POC for GitHub-based API Reviews (Phase 2)#47443
tjprescott wants to merge 55 commits into
mainfrom
APIReviewSync

Conversation

@tjprescott

Copy link
Copy Markdown
Member

Outlines the process for ensuring that changes to working branches are synced to any open review PRs.

Adds implementation of the proposed pipelines.

tjprescott and others added 30 commits May 28, 2026 09:53
Co-authored-by: mikeharder <9459391+mikeharder@users.noreply.github.com>
Co-authored-by: tjprescott <5723682+tjprescott@users.noreply.github.com>
@tjprescott tjprescott requested a review from mikeharder June 10, 2026 20:55
@tjprescott tjprescott changed the base branch from main to GenerateAPITextScript June 10, 2026 20:55
@tjprescott tjprescott changed the title Proposal: API Review Sync Pipelines Python POC for GitHub-based API Reviews (Phase 2) Jun 12, 2026
Base automatically changed from GenerateAPITextScript to main June 12, 2026 23:34
…into APIReviewSync

# Conflicts:
#	.github/workflows/api-consistency.yml
#	.github/workflows/api-md-workflow-tests.yml
#	eng/tools/azure-sdk-tools/azpysdk/apistub.py
#	eng/tools/azure-sdk-tools/tests/test_apistub.py
#	scripts/api_md_workflow/create_api_review_pr.py
#	scripts/api_md_workflow/create_api_review_pr_test.py
@tjprescott tjprescott marked this pull request as ready for review June 15, 2026 16:19
@tjprescott tjprescott requested a review from danieljurek as a code owner June 15, 2026 16:19
Copilot AI review requested due to automatic review settings June 15, 2026 16:19
@tjprescott tjprescott requested a review from a team as a code owner June 15, 2026 16:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements “Phase 2” of the GitHub-based API review prototype by adding a dispatcher + sync mechanism that keeps open API review PR branches in sync with validated api.md / api.metadata.yml artifacts from a working branch once CI gates pass.

Changes:

  • Adds a dispatcher script and workflow to evaluate a “final CI gate”, discover matching open [API Review] PRs via embedded metadata, and dispatch per-review-branch sync runs.
  • Adds a sync script and workflow that compares/copies api.md + api.metadata.yml from a validated working SHA into the review branch and force-pushes with lease when changes exist.
  • Consolidates Node tooling dependencies under .github/package.json (removing the separate .github/chronus package definition/lock).

Reviewed changes

Copilot reviewed 12 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
scripts/api_md_workflow/sync_review_branches_plan.md Design/implementation plan describing gating, discovery, sync behavior, and safety checks.
.github/workflows/src/api-md-review-sync/sync_review_branch.test.js Unit tests for artifact diff/copy behavior and stale-SHA skipping.
.github/workflows/src/api-md-review-sync/sync_review_branch.js Sync implementation for comparing/copying API artifacts and pushing updates to review branches.
.github/workflows/src/api-md-review-sync/dispatch_review_branch_syncs.test.js Unit tests for metadata parsing, PR matching, dispatching, and CI gate evaluation.
.github/workflows/src/api-md-review-sync/dispatch_review_branch_syncs.js Dispatcher implementation: final CI gating, metadata parsing, PR discovery, and workflow dispatch.
.github/workflows/api-md-sync-review-branch.yml Workflow to perform a single review-branch sync from working SHA artifacts.
.github/workflows/api-md-dispatch-review-syncs.yml Workflow to resolve final CI gate and dispatch sync workflows for matching review PRs.
.github/shared/src/simple-git.js Shared helper to resolve a git repo root via simple-git.
.github/shared/src/github.js Shared GitHub-related enum constants/types (status/check terminology).
.github/shared/src/changed-files.js Shared helper to compute changed files via git diff (now enables simple-git debug).
.github/package.json Consolidated/pinned Node dependencies for GitHub automation and workflows.
.github/chronus/package.json Removed (Chronus tooling dependency definition moved to .github/package.json).
.github/chronus/package-lock.json Removed (Chronus lockfile no longer needed under .github/chronus).
Files not reviewed (1)
  • .github/chronus/package-lock.json: Generated file

Comment thread .github/workflows/src/api-md-review-sync/dispatch_review_branch_syncs.js Outdated
Comment thread .github/workflows/src/api-md-review-sync/sync_review_branch.js
Comment thread .github/shared/src/changed-files.js Outdated
Comment thread .github/workflows/api-md-dispatch-review-syncs.yml

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Comment thread .github/workflows/src/api-md-review-sync/sync_review_branch.js Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.

env:
GH_TOKEN: ${{ github.token }}
run: |
gh run download "${{ steps.gate.outputs.consistency_run_id }}" --name api-md-affected-packages --dir .artifacts
Comment on lines +280 to +286
const pullRequest = selectWorkingPullRequest(await getCommitPullRequestsFn(workingSha), workingSha);
if (!pullRequest) {
return { ready: false, reason: `No open pull request found for ${workingSha}.` };
}
if (pullRequest.head.ref.startsWith("apireview/")) {
return { ready: false, reason: `Skipping API review branch ${pullRequest.head.repo.owner.login}:${pullRequest.head.ref}.` };
}
Comment on lines +256 to +258
const statusPassed = status && PASSING_STATUS_STATES.has(status.state);
const checkRunPassed =
checkRun && !isCurrentDispatcherRun(checkRun, currentRunId) && checkRun.status === "completed" && PASSING_CHECK_CONCLUSIONS.has(checkRun.conclusion);
Comment on lines +40 to +43
return workingPaths.some((workingPath, index) => {
const reviewPath = reviewPaths[index];
return !readRequiredFile(workingPath).equals(Buffer.from(readFileOrUndefined(reviewPath) || ""));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants