Commit bd1ea0d
[Internal] Tooling: Adds msdata/direct sync Copilot agent and helper script (#5681)
# Pull Request Template
## Description
This PR adds a **Copilot agent** and **PowerShell helper script** to
automate the `msdata/direct` branch sync workflow, which merges the v3
`master` branch into `msdata/direct` and syncs files from the internal
msdata CosmosDB repository.
### Problem
The msdata/direct sync process ([documented
here](docs/sync_up_msdata_direct.md)) is a manual, multi-step workflow
involving branch creation, merging, conflict resolution, file syncing
via `msdata_sync.ps1`, build validation, and PR creation. This process
is error-prone and time-consuming when done manually.
### Solution
Two new automation tools:
#### 1. Copilot Agent
(`.github/agents/msdata-direct-sync-agent.agent.md`)
A structured agent with 5 workflow phases:
| Phase | Description |
|-------|-------------|
| **Phase 1: Environment Setup** | Validates prerequisites (git, dotnet,
gh CLI), prompts for msdata repo path |
| **Phase 2: Branch Preparation** | Creates feature branch from
`msdata/direct`, merges latest `master`, resolves conflicts |
| **Phase 3: msdata File Sync** | Configures and runs `msdata_sync.ps1`
with user-provided repo path, handles missing files |
| **Phase 4: Build Validation** | Runs `dotnet build` to verify sync
succeeded, provides troubleshooting guidance |
| **Phase 5: PR Creation** | Stages, commits, pushes, creates draft PR
with proper format and reviewers |
**Usage:**
```
Follow the msdata/direct sync agent plan in .github/agents/msdata-direct-sync-agent.agent.md
Sync the msdata/direct branch with the latest v3 master and msdata direct codebase.
```
#### 2. PowerShell Helper Script (`tools/msdata-direct-sync-helper.ps1`)
Automates the mechanical parts of the workflow. Can run the full
workflow or individual phases:
```powershell
# Full workflow
.\tools\msdata-direct-sync-helper.ps1 -MsdataRepoPath "Q:\CosmosDB"
# Individual phases
.\tools\msdata-direct-sync-helper.ps1 -MsdataRepoPath "Q:\CosmosDB" -Phase Setup
.\tools\msdata-direct-sync-helper.ps1 -MsdataRepoPath "Q:\CosmosDB" -Phase Branch
.\tools\msdata-direct-sync-helper.ps1 -MsdataRepoPath "Q:\CosmosDB" -Phase Sync
.\tools\msdata-direct-sync-helper.ps1 -MsdataRepoPath "Q:\CosmosDB" -Phase Build
.\tools\msdata-direct-sync-helper.ps1 -MsdataRepoPath "Q:\CosmosDB" -Phase PR
```
**Key features:**
- Prompts for msdata repo path at runtime (no hardcoded paths)
- Auto-detects GitHub username for branch naming
- Branch naming: `users/<username>/update_msdata_direct_<mm_dd_yyyy>`
- Automatically reverts `msdata_sync.ps1` path changes after sync
- Creates draft PR with standard reviewers and description
- Phase-by-phase execution for debugging or re-running failed steps
#### 3. Documentation Update (`docs/sync_up_msdata_direct.md`)
Updated to reference the new agent and helper script as recommended
automated alternatives, and added the latest sample PR (#5612).
### Design Decisions
- **msdata repo path prompted at runtime**: Different developers have
the repo at different local paths
- **`[Internal]` PR prefix**: This is internal tooling, not
customer-facing
- **Draft PR by default**: Follows repository convention of creating
drafts first
- **Conflict resolution strategy**: Accept incoming master changes by
default, with manual review flagged for critical files
## Type of change
- [x] New feature (non-breaking change which adds functionality)
## Does this pull request offer a public API change?
No - this is internal tooling only (agent + script), no SDK API changes.
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Kiran Kumar Kolli <kirankk@microsoft.com>1 parent d892736 commit bd1ea0d
3 files changed
Lines changed: 1175 additions & 1 deletion
File tree
- .github/agents
- docs
- tools
0 commit comments