Summary

  • Situation: currently user sites are created off of whole GitHub repositories.
  • Problem: it's not possible to publish only a specific part(s) of a repository without moving it to a separate repository and publishing it alone.
  • Solution: add "Root directory" config option to site settings page and site creation wizard, fetching and copying over only the contents of that GitHub repo subdirectory to R2.
  • Appetite: 1d

Situation

Currently user sites are created off of whole GitHub repositories, meaning that when creating a site the app will fetch all the files from a provided GitHub repo and upload them to R2 (excluding unsupported file types, e.g. code scripts).

Problem

It's not possible to have different parts of content in a single repository and publish only one/some of them. If you want to do that, you'd need to move the part(s) you want to publish to a separate repository and publish only it.

Specific use cases currently not supported:

  • publish /docs folder with my app's documentation and still have them in the same repository as my app
  • publish different parts of my digital garden separately (or only selected parts of it that I want to make public)

Appetite

1d

Solution

R2 bucket:

  • /{siteId}/{branch}/raw/{repoContents}
  • /{siteId}/{branch}/raw/{rootDirContents}
  • /{siteId}/{branch}/_tree

Steps:

  • add rootDir to project schema
  • add "Root Directory" config field to site config page and:
    • Option A: use root dir by default so no new field added to the project creation modal ❌ would potentially involve copying unneeded files if a user already knows he wants to publish only a subdirectory
    • Option B: add "Root Directory" config field to site creation modal (with default value set to /) ✅
  • site creation procedure:
    • fetch repo files inside rootDir only and upload to R2
  • on change of rootDir on site settings page:
    • rm current project contents from R2
    • fetch repo files inside rootDir only and upload to R2

Rabbit holes

  • Any changes to sync status needed? No, sync status shows if files in R2 and GitHub differ based on tree hashes only. And we're going to update R2 contents right after the user sets different rootDir value.
  • Any updates to existing sites needed? No, existing sites will exist as if they were created with the default / root dir.
Built with DataHub LogoDataHub Cloud