Summary
Explore ways to let contributors update their profile (contributors/{username}.md in the data repo) from the leaderboard web app, without embedding org GitHub PATs or calling GitHub APIs from the static site.
Context
- Data repo URL is available as
leaderboard.data_source (e.g. https://github.com/ohcnetwork/leaderboard-data).
- Example profile file:
https://github.com/ohcnetwork/leaderboard-data/blob/production/contributors/rithviknishad.md.
- Next.js app is static export; build-time data comes from LibSQL.
Option A: Deep link to GitHub file editor + clipboard
Edit URL (when repo + branch are known):
https://github.com/{owner}/{repo}/edit/{branch}/contributors/{username}.md
Gap: data_source is only the repo URL today. We likely need an optional config field (e.g. leaderboard.data_branch, default main) because many orgs use non-default branches (e.g. production).
Pre-filling the editor via URL: GitHub does not document supported query parameters to inject file body content on the /edit/... page (unlike issues/PRs). Community threads exist; this is not a reliable product surface.
Practical UX without API:
- Edit on GitHub → opens the web editor for that path.
- Copy profile as Markdown → build YAML frontmatter + body from DB fields (
Contributor type: username, name, role, title, avatar_url, social_profiles, joining_date, meta, bio) using js-yaml, user pastes into GitHub.
- Optional: For public repos, browser
fetch of raw.githubusercontent.com/.../contributors/{username}.md for byte-accurate "copy current file" (best-effort; private repos need another path).
Fidelity: Reconstructing from DB may drop YAML keys/comments never stored in the DB.
Option B: Form → prefilled GitHub issue → Actions “rolling PR” (changesets-style)
Flow:
- Leaderboard hosts a form; submit opens Create issue with
title / body query params (supported by GitHub).
- Body uses a strict, versioned format (e.g. fenced YAML/JSON) the workflow parses.
- Workflow in the data repo (where markdown lives) on
issues: opened (or on label after review):
- Validates payload; comments on failure.
- Maintains one open integration PR until merged; new issues add commits to the same branch.
- Commits / PR description use
Fixes #123 so issues close when the PR merges.
Strengths: Guided UX, audit trail, no PAT on the static site; uses GITHUB_TOKEN in Actions.
Design risks to address:
- Authorization: Public issues must not allow arbitrary edits to any profile. Mitigations: only process if issue author matches profile
username, and/or require maintainer label (e.g. profile-update-approved), etc.
- Concurrency: Two issues editing the same
contributors/{user}.md need a defined rule (last wins, reject, queue).
- Branch hygiene: Long-lived PR may need merging
main in periodically; define reset after merge.
Permissions: Workflow needs appropriate contents, pull-requests, and possibly issues scopes in the data repo.
Recommendation
- Ship Option A as low-friction (link + copy + optional raw copy) with
data_branch config.
- Consider Option B for contributor-friendly submissions and maintainer-controlled batching, possibly alongside Option A for power users.
References
Discussion consolidated from internal design chat; implementation TBD.
Summary
Explore ways to let contributors update their profile (
contributors/{username}.mdin the data repo) from the leaderboard web app, without embedding org GitHub PATs or calling GitHub APIs from the static site.Context
leaderboard.data_source(e.g.https://github.com/ohcnetwork/leaderboard-data).https://github.com/ohcnetwork/leaderboard-data/blob/production/contributors/rithviknishad.md.Option A: Deep link to GitHub file editor + clipboard
Edit URL (when repo + branch are known):
https://github.com/{owner}/{repo}/edit/{branch}/contributors/{username}.mdGap:
data_sourceis only the repo URL today. We likely need an optional config field (e.g.leaderboard.data_branch, defaultmain) because many orgs use non-default branches (e.g.production).Pre-filling the editor via URL: GitHub does not document supported query parameters to inject file body content on the
/edit/...page (unlike issues/PRs). Community threads exist; this is not a reliable product surface.Practical UX without API:
Contributortype: username, name, role, title, avatar_url, social_profiles, joining_date, meta, bio) usingjs-yaml, user pastes into GitHub.fetchofraw.githubusercontent.com/.../contributors/{username}.mdfor byte-accurate "copy current file" (best-effort; private repos need another path).Fidelity: Reconstructing from DB may drop YAML keys/comments never stored in the DB.
Option B: Form → prefilled GitHub issue → Actions “rolling PR” (changesets-style)
Flow:
title/bodyquery params (supported by GitHub).issues: opened(or on label after review):Fixes #123so issues close when the PR merges.Strengths: Guided UX, audit trail, no PAT on the static site; uses
GITHUB_TOKENin Actions.Design risks to address:
username, and/or require maintainer label (e.g.profile-update-approved), etc.contributors/{user}.mdneed a defined rule (last wins, reject, queue).mainin periodically; define reset after merge.Permissions: Workflow needs appropriate
contents,pull-requests, and possiblyissuesscopes in the data repo.Recommendation
data_branchconfig.References
Discussion consolidated from internal design chat; implementation TBD.