I have a Blazor server side application that wraps a REACT modeling tool. The REACT application updates a JSON Model that is passed to/from the Blazor application. The REACT client is a modeling tool that frequently updates the model which is pushed back to the Blazor app which saves it into the browser's Indexed DB. A private GitHub repo is where the JSON Model will originate from and all changes to this file will be pushed by the the Blazor App via a commit command which is to push the model from Indexed DB over to the GitHub repository.
A separate Domain API provides the GitHub Account and Repository details that the Blazor App integrates at startup.
The following is the flow I am trying to achieve;
- At startup, the Blazor App will get the GitHub Account and Repo Details via an domain service.
- The Blazor App will fetch the Model from the repository
- The model will be saved into Indexed DB and pushed to the React Modeling Tool where changes are pushed back from the React Modeling Tool to Blazor which updates the changes against the Indexed DB store
- The User can invoke a commit at anytime which needs to push the changed model back to the GitHub Repo.
NOTE: Some additional context.. the same GitHub repo that hosts the JSON model will have many other additional source files other than just the model as there is a separate server-side code-generation Azure DevOps custom agent that clones the same repository and from which generates code as per the model, upon completion of code generation, it will commit back in the generated code artifacts into the same repo.
I am thinking of using LibGit2Sharp as the .Net Client to interact with GitHub which seems easy enough to be able to retrieve the model file however I am not sure how to commit the changes of the model back via LibGit2Sharp given that I am not cloning the entire repo and that I am not storing to a local file store.
Can anyone provide additional guidance on using LibGit2Sharp to commit the model file changes back into GitHub?