Skip to content

Add Git integration cmdlets - #217

Merged
NowinskiK merged 2 commits into
developfrom
feature/git-integration-cmdlets
Nov 7, 2026
Merged

NowinskiK merged 2 commits into
developfrom
feature/git-integration-cmdlets

Conversation

@NowinskiK

Copy link
Copy Markdown
Collaborator

Closes #48

Adds nine cmdlets that wrap the Fabric Git REST APIs, following the design agreed in #48 (comment).

API Cmdlet
Connect Connect-FabricGit
Disconnect Disconnect-FabricGit
Get Connection Get-FabricGitConnection
Initialize Connection Initialize-FabricGitConnection
Get Status Get-FabricGitStatus
Commit To Git Invoke-FabricGitCommit
Update From Git Invoke-FabricGitUpdate
Get My Git Credentials Get-FabricGitCredential
Update My Git Credentials Update-FabricGitCredential

Design decisions applied

  • Provider type: -GitProviderType is mandatory on Connect-FabricGit. It must match the parameter set used: Azure DevOps needs -OrganizationName/-ProjectName, GitHub needs -OwnerName. If they don't match, the cmdlet throws a clear error before calling the API. GitHub also requires -ConnectionId.
  • Connect and initialize together: Connect-FabricGit -Initialize [-InitializationStrategy] [-NoWait] connects and initializes in one call. Initialize-FabricGitConnection is still available for workspaces that are already connected.
  • Automatic lookup: if you don't pass WorkspaceHead or RemoteCommitHash, Invoke-FabricGitCommit and Invoke-FabricGitUpdate get them from Get-FabricGitStatus. -NoAutoResolve turns this off.

Other behaviour

  • Pipeline input: every cmdlet takes WorkspaceId from the pipeline by property name (alias Id), so Get-FabricWorkspace | Get-FabricGitStatus works.
  • Status output: Get-FabricGitStatus -ChangesOnly / -ConflictsOnly returns one flat object per changed item. You can filter these and pipe them into Invoke-FabricGitCommit, which commits the selected items in a single API call per workspace.
  • Confirmation: all cmdlets that change state support -WhatIf/-Confirm. Disconnect-FabricGit and Invoke-FabricGitUpdate use ConfirmImpact = 'High'.
  • API calls and errors: all calls go through Invoke-FabricRestMethod with hash splatting and HandleResponse = $true, which handles long-running operations and throttling. API errors are thrown rather than swallowed.

Example

$ws = (Get-FabricWorkspace -WorkspaceName 'Sales').id
$init = Connect-FabricGit -WorkspaceId $ws -GitProviderType AzureDevOps -OrganizationName 'contoso' `
    -ProjectName 'Fabric' -RepositoryName 'sales' -BranchName 'main' -Initialize -InitializationStrategy PreferRemote
if ($init.requiredAction -eq 'UpdateFromGit') { Invoke-FabricGitUpdate -WorkspaceId $ws -Confirm:$false }

Get-FabricGitStatus -WorkspaceId $ws -ChangesOnly |
    Where-Object ItemType -eq 'Notebook' |
    Invoke-FabricGitCommit -Comment 'Notebooks only'

Testing

  • 90 new unit tests (one file per cmdlet in tests/Unit/). They cover request URIs, methods, bodies, parameter sets, pipeline binding, -WhatIf, automatic lookup and -NoAutoResolve, and error paths. All pass.
  • The full unit suite and the QA suite (tests/QA) pass with no failures.
  • Not yet tested against a live Fabric workspace. The request bodies follow the Fabric Git API documentation, so a manual run of connect → initialize → status → commit/update is recommended before merging.

Docs

  • Nine new help pages were generated with Generate_help_from_built_module, and the cmdlets were added to docs/en-US/FabricTools.md.
  • The generator also rewrote about 200 unrelated help pages (date changes and differences from their source). Those changes are left out of this PR on purpose.
  • CHANGELOG.md has an entry under [Unreleased] / Added.

🤖 Generated with Claude Code

Kamil Nowinski and others added 2 commits November 7, 2026 22:34
Add nine cmdlets wrapping the Fabric Git REST APIs (#48):
Connect-FabricGit, Disconnect-FabricGit, Get-FabricGitConnection,
Initialize-FabricGitConnection, Get-FabricGitStatus,
Invoke-FabricGitCommit, Invoke-FabricGitUpdate,
Get-FabricGitCredential and Update-FabricGitCredential.

Connect-FabricGit requires -GitProviderType and checks it against the
AzureDevOps/GitHub parameter sets; -Initialize connects and initializes
in one call. Commit and update look up the workspace head and remote
commit hash automatically unless -NoAutoResolve is used. Status output
can be flattened and piped into Invoke-FabricGitCommit to commit
selected items.

Includes unit tests, generated help pages and a CHANGELOG entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

Linux Test Results

    1 files  1 063 suites   58s ⏱️
3 246 tests 3 237 ✅ 9 💤 0 ❌
3 247 runs  3 238 ✅ 9 💤 0 ❌

Results for commit e5e5c7e.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

WinPS51 Test Results

    1 files  1 064 suites   1m 14s ⏱️
3 461 tests 3 452 ✅ 9 💤 0 ❌
3 462 runs  3 453 ✅ 9 💤 0 ❌

Results for commit e5e5c7e.

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

WinPS71 Test Results

    1 files  1 064 suites   1m 9s ⏱️
3 461 tests 3 452 ✅ 9 💤 0 ❌
3 462 runs  3 453 ✅ 9 💤 0 ❌

Results for commit e5e5c7e.

@NowinskiK
NowinskiK merged commit 0648001 into develop Nov 7, 2026
8 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.

1 participant