Skip to content

RFC: Contributor profile editing from leaderboard (GitHub edit link, copy markdown, optional issue-driven bot) #753

Description

@rithviknishad

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:

  1. Edit on GitHub → opens the web editor for that path.
  2. 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.
  3. 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:

  1. Leaderboard hosts a form; submit opens Create issue with title / body query params (supported by GitHub).
  2. Body uses a strict, versioned format (e.g. fenced YAML/JSON) the workflow parses.
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFCRequest for Comments

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions