Skip to content

Add initial implementation of Microsoft.DotNet.GitAutomation library#2158

Merged
lbussell merged 17 commits into
mainfrom
lbussell/automation-code
Jul 14, 2026
Merged

Add initial implementation of Microsoft.DotNet.GitAutomation library#2158
lbussell merged 17 commits into
mainfrom
lbussell/automation-code

Conversation

@lbussell

@lbussell lbussell commented Jun 22, 2026

Copy link
Copy Markdown
Member

This PR is the start of #2152. It has a small initial scope focusing only on creating pull requests on GitHub.

Comment thread src/Automation/GitWorkspace.cs Fixed
Comment thread src/Automation/GitWorkspace.cs Fixed
Comment thread src/Automation/GitWorkspace.cs Fixed

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

Introduces an initial Microsoft.DotNet.Automation library intended to provide a service-agnostic reconciliation API for automating git commits, branches, and (currently GitHub-only) pull requests, forming the foundation for the broader automation library described in #2152.

Changes:

  • Adds a new Microsoft.DotNet.Automation project with branch and pull request “ensure desired state” APIs.
  • Implements git operations via the git CLI (GitWorkspace/GitCli) and GitHub PR operations via Octokit (GitHubPullRequestApi).
  • Wires the new project into the repo solution (Microsoft.DotNet.DockerTools.slnx).

Reviewed changes

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

Show a summary per file
File Description
src/Automation/RepoHostEngine.cs Core reconciliation engine for ensuring branch content and PR state; contains create/update logic and foreign-commit policy handling.
src/Automation/RemoteRepo.cs Abstraction for remote repositories, including authenticated clone URL construction.
src/Automation/README.md Usage docs and examples for ensuring PRs/branches and configuring policies.
src/Automation/PullRequestUpdateStrategy.cs Defines append vs replace strategy for PR updates.
src/Automation/PullRequestSpec.cs Defines desired-state contract for an automated PR (key, target branch, apply callback, policies).
src/Automation/PullRequestResult.cs Result object for PR ensure operations (outcome, URL, commits, details).
src/Automation/PullRequestOutcome.cs Enumerates possible PR ensure outcomes (unchanged/created/updated/stopped/dry-run).
src/Automation/PullRequestInfo.cs Internal representation of a PR as seen via IPullRequestApi.
src/Automation/Microsoft.DotNet.Automation.csproj New packable library project with logging abstractions + Octokit dependencies.
src/Automation/IRepoHost.cs Public interface for ensuring PRs and direct branch updates.
src/Automation/IPullRequestApi.cs Internal service-specific PR API surface used by the engine.
src/Automation/IGitContext.cs Public interface for producing commits in a temporary workspace.
src/Automation/GitWorkspace.cs Temporary clone implementation and git operations (clone, fetch, commit, push, diff logging).
src/Automation/GitHub/GitHubRepoHost.cs Public GitHub-backed IRepoHost implementation wiring engine + GitHub API client.
src/Automation/GitHub/GitHubRepo.cs GitHub RemoteRepo implementation and clone/auth URL handling.
src/Automation/GitHub/GitHubPullRequestApi.cs Octokit-backed PR/comment operations used by the engine.
src/Automation/GitException.cs Exception type that masks credentials in command/error text.
src/Automation/GitContext.cs Default IGitContext implementation that commits via GitWorkspace.
src/Automation/GitCommit.cs Commit model plus helper to extract subject line.
src/Automation/GitCliResult.cs Wrapper for git stdout output plus trimming helper.
src/Automation/GitCli.cs Git CLI execution wrapper with secret masking in logs/errors.
src/Automation/GitAutomationOptions.cs Shared options (token, author, dry run).
src/Automation/GitAuthor.cs Commit author identity record.
src/Automation/ForeignCommitPolicy.cs Policy for handling commits not authored by automation.
src/Automation/BranchSpec.cs Desired-state contract for direct branch updates.
src/Automation/BranchResult.cs Result object for branch ensure operations (outcome, commits).
src/Automation/BranchOutcome.cs Enumerates possible branch ensure outcomes.
Microsoft.DotNet.DockerTools.slnx Adds the new Automation project to the solution for CI build/test inclusion.

Comment thread src/Automation/README.md Outdated
Comment thread src/Automation/README.md Outdated
Comment thread src/Automation/RepoHostEngine.cs Outdated
Comment thread src/Automation/GitHub/GitHubRepo.cs Outdated
Comment thread src/Automation/RepoHostEngine.cs Outdated
Comment thread src/Automation.Tests/GitTestRepo.cs Fixed
Comment thread src/Automation.Tests/GitTestRepo.cs Fixed
Comment thread src/Automation.Tests/GitTestRepo.cs Fixed
Comment thread src/Automation.Tests/GitTestRepo.cs Fixed
Comment thread src/Automation.Tests/AutomationHarnessTests.cs Fixed
@lbussell
lbussell force-pushed the lbussell/automation-code branch from 495bf39 to 559c3f8 Compare July 8, 2026 00:15
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Fixed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Fixed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Fixed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Fixed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Fixed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Fixed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Fixed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Fixed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Fixed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Fixed
@lbussell
lbussell force-pushed the lbussell/automation-code branch from ff8f1f9 to 2162a40 Compare July 8, 2026 17:28
@lbussell
lbussell marked this pull request as ready for review July 8, 2026 17:29
@lbussell
lbussell requested a review from a team as a code owner July 8, 2026 17:29
@lbussell
lbussell force-pushed the lbussell/automation-code branch from 2162a40 to 7c634c9 Compare July 8, 2026 17:31
@lbussell

lbussell commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

@mthalman This one is finally ready for review.

Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Fixed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Fixed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Fixed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Fixed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Fixed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Fixed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Fixed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Fixed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Fixed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Fixed
Comment thread src/GitAutomation/Microsoft.DotNet.GitAutomation.csproj
Comment thread src/Automation/PullRequestManager.cs Outdated
Comment thread src/Automation/Planner.cs Outdated
Comment thread src/GitAutomation/Models.cs
Comment thread src/Automation/Git.cs Outdated
Comment thread src/GitAutomation/Models.cs
lbussell and others added 7 commits July 9, 2026 09:12
When updating an existing pull request in append mode, clone the configured PR source repo instead of always cloning upstream. This allows fork-backed PR branches to be updated from their actual source repository.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Expose internals to the test assembly and make planner-only models, operations, results, and helpers internal so the package only exposes caller-facing pull request automation types.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Generate XML documentation for the Automation package and remove Arcade's CS1591 suppression so missing public API docs fail under TreatWarningsAsErrors. Add the currently missing public XML comments.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@lbussell lbussell changed the title Add initial implementation of Microsoft.DotNet.Automation library Add initial implementation of Microsoft.DotNet.GitAutomation library Jul 10, 2026
@lbussell
lbussell requested a review from mthalman July 10, 2026 20:16
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Dismissed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Dismissed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Dismissed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Dismissed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Dismissed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Dismissed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Dismissed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Dismissed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Dismissed
Comment thread src/GitAutomation.Tests/PullRequestPropertyTests.cs Dismissed
Comment thread src/GitAutomation/PullRequestAutomationServiceCollectionExtensions.cs Outdated
lbussell added 2 commits July 13, 2026 13:13
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 54d39da9-5918-4058-ad46-95935dcc127c
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 54d39da9-5918-4058-ad46-95935dcc127c
lbussell added 4 commits July 13, 2026 13:25
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 54d39da9-5918-4058-ad46-95935dcc127c
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 54d39da9-5918-4058-ad46-95935dcc127c
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 54d39da9-5918-4058-ad46-95935dcc127c
@lbussell
lbussell requested review from Copilot and mthalman and removed request for Copilot July 13, 2026 21:00
@lbussell
lbussell merged commit a70f964 into main Jul 14, 2026
21 checks passed
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