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

git(hub) integration feature

Open sgfost opened this issue 1 year ago • 1 comments

this relies on changes in #790


part 1 (1-way mirror):

adds a button that allows model submitters to create an auto-updating, read-only git repository archive which is hosted on a central organization

the 'mirror' git repository consists of commits for each release that are tagged and branched off so that metadata can be updated for individual releases without re-writing history

additions

  • library.fs.CodebaseGitRepositoryApi: functionality for building/updating a git repository from a Codebase
  • library.github.GithubApi: provides an interface over PyGithub for interacting with repositories on github
  • library.github.GithubRepoNameValidator: provides validate() to make sure a repo name is valid and unused
  • mirror_codebase() and update_mirrored_codebase() huey tasks which call the CodebaseGitRepositoryApi to build the git repo on the file system and then GithubApi to create/push to the remote
  • update_mirrored_release_metadata() huey task which is triggered when there is an update to codemeta, and updates the corresponding release branch in git after the submission package is rebuilt
  • feature overview page at /github/
  • button + form on the release detail page for mirroring a codebase

configuration steps

  1. create an app on the comses-model-library organization with the following permissions:
    • Administration: read and write
    • Contents: read and write
    • Metadata: read only
  2. create a webhook secret and set the webhook url <HOST>/github-sync-webhook/ ** the trailing slash is very important for some reason
  3. subscribe to the Release webhook event
  4. generate private key
  5. install the app on the organization and add the installation id to .env
  6. add the app id, app name, and organization name to .env
  7. add the private key and webhook secret to secrets/

sgfost avatar Jan 09 '25 21:01 sgfost

I believe all of the main functionality for the 2-way sync is now implemented and works for simple cases. Likely not bulletproof nor polished so I now need to do lots and lots of testing

sgfost avatar Mar 21 '25 20:03 sgfost

replaced by #815

sgfost avatar May 24 '25 00:05 sgfost