comses.net icon indicating copy to clipboard operation
comses.net copied to clipboard

GitHub integration

Open sgfost opened this issue 7 months ago • 0 comments

Adds a feature called GitHub Sync to the model library which allows for:

  • "pushing": transforming models in the CML into git repos and automatically pushing to a github repo, which is updated with new releases
  • "importing": pulling releases made on a GitHub repository into the CML as new releases (of a special "imported" type) which can be published/peer reviewed

In tandem, these allow for a bi-directional sync but can be set up/toggled independently

Setup/management is done by the submitter on a configuration page for each codebase, accessible from the sidebar of a codebase page or the feature overview page (/github/). From there, one is walked through the process including connecting a github account with the existing oauth flow and installing our github app on the same account, then given the option of:

  • syncing with a new repository: builds and pushes a git repo, (by default) enables pushing and importing so that future releases from either end will get synced
  • syncing with an existing repository: enables importing so that future releases made on GitHub will be downloaded as new CML releases

configuration

-> https://github.com/comses/infra/wiki/GitHub-Sync

details

new models

  • GithubIntegrationAppInstallation: tracks the github app installation status for a user
  • CodebaseGitMirror: represents a local git repository built from a submission
  • CodebaseGitRemote: represents a remote repository that should be pushed to and/or checked for new releases
  • ImportedReleasePackage: information about where an imported release came from, the existence of this means a release was imported from github, and should be treated differently in some cases
  • GitHubSyncConfiguration: feature settings (whether creating new sync/remotes is enabled, whether the feature should be marked as beta)
  • GitHubSyncFaqEntry: FAQ entries shown on the feature overview page

github APIs

  • GitHubApi: main wrapper for github operations (auth, pushing, creating releases, etc.)
  • GitHubReleaseImporter: handles importing releases from github by downloading the archive, extracting metadata, and creating a new CodebaseRelease

filesystem

  • CodebaseGitRepositoryApi: manages local git repository operations like building and updating a git repo from a codebase's (public) releases
  • FileCategories/CategoryManifestManager: file categorization changed in order to handle imported releases which are not organized into category directories, information is instead kept in a manifest in the db and updated by the submitter
  • ImportedCodebaseReleaseFsApi: sibling filesystem API of the regular CodebaseReleaseFsApi with some special handling and additional functionality
  • adds generated LICENSE and CITATION.cff files to new release packages

webhooks

library.views.github_sync_webhook: the github app sends webhook events to the server and we respond to installation events (to track user installations) and release events (to import releases when enabled)

sgfost avatar May 24 '25 00:05 sgfost