r/MicrosoftFabric • • 3d ago

CI/CD GitHub integration - Undo API call

I have been creating scripts for automated deployment using the git integration. Any change to the main branch automatically triggers the update of a workspace.
I have had some scenarios though were something goes wrong and I need to reset the workspace to re-sync with what is currently in the main branch in GitHub. I can manually use the Undo button, but I want to automate this step. Is there an API for that?

3 Upvotes

3 comments sorted by

2

u/Environmental-Fun833 3d ago

Yep, there's an API for that. `POST /workspaces/{ws}/git/updateFromGit`. You'll use PreferRemote in this case.

{

"remoteCommitHash": "<from git/status>",

"workspaceHead": "<from git/status, omit on first sync>",

"conflictResolution": { "conflictResolutionType": "Workspace", "conflictResolutionPolicy": "PreferRemote" },

"options": { "allowOverrideItems": true }

}

1

u/One-Barber-264 1d ago edited 1d ago

That's the function I have been using, but it doesn't seem to revert uncommitted workspace changes. The documentation actually states

The update only affects items in the workspace that were changed in those commits. 

https://learn.microsoft.com/en-us/rest/api/fabric/core/git/update-from-git?tabs=HTTP

1

u/CICDExperience05 ‪ ‪Microsoft Employee ‪ 13h ago

Hi u/One-Barber-264
Currently we don't have public api that support this capability. but we do have plans to support this in the upcoming months. no ETA yet.