GitHub Discussions · GraphQL API · Community tooling · 2026 · Solo — popularity-led research, engagement ranking algorithm, GitHub Discussions GraphQL integration, server-side token proxy, TDD, interaction design, exact-SHA deployment
Study Sync
An engagement-ranked GitHub Discussions workspace: surface the top 5 threads by reactions + comments + recency, compose a structured response, and publish it as a real Discussion comment through the GitHub GraphQL API.
The problem
GitHub Discussions threads accumulate without enough quality responses. Maintainers want to engage with high-value threads but face friction: identifying which ones are worth responding to (vs. low-engagement noise) and composing a structured response. Study Sync surfaces engagement-ranked threads (reactions × 2 + comments + recency bonus) from any public repository and provides a structured compose workspace — analysis, question, or answer — then posts the response as a real formatted Discussion comment via GitHub’s Discussions-only GraphQL API. The nightly concept came from secure radar run radar-20260901T214551-21401012 (SHA eee3d5e493c77379a0f234c0ba8c583f3ca853fc7332563b6b6b88642de9ec6d): THU-MAIC/OpenMAIC was daily rank #1 with 3,128 stars gained that day and 29,748 total stars. The adjacent product translates OpenMAIC’s community learning loop — which operates through GitHub Discussions — into an original contribution workspace, not a clone of the classroom generator.
Architecture
Key decisions
Operate surface instead of a discovery dashboard
Most GitHub discussion tools are readers or notification feeds — inspect-only. Study Sync commits to the Operate surface: the user’s goal is to publish something, not browse. The two-panel layout (ranked list on the left, compose workspace on the right) makes the completion action — posting a comment — the center of gravity rather than an afterthought.
Server-side GraphQL proxy — token never leaves the server
GitHub Discussions requires a token with discussion:write scope. Exposing this token in the browser would allow XSS token theft. Both API routes hold the token in server environment variables and accept it as a request body parameter (never in query strings or response bodies). The client sees only discussion metadata and the resulting comment URL.
Compound GraphQL query to avoid N+1 calls
The GitHub Discussions GraphQL schema requires reactions, comments, author, and node ID for both ranking and posting. A naive implementation would make one request per field. Study Sync fetches all engagement data in one compound query, including the discussion node ID needed for addDiscussionComment, which is a GraphQL-only field with no REST equivalent.
TDD engagement algorithm before UI
Forty tests were written and watched fail before any implementation module existed. The tests cover URL parsing (github.com/owner/repo, bare owner/repo, sub-paths, invalid formats), the engagement scoring formula (reactions × 2 + comments + 5-point recency bonus for threads active in the last 7 days), top-N ranking, formatCommentBody with three type labels, validateToken for four token formats, sanitizeBody, buildDiscussionsQuery with and without cursor, and extractDiscussionsFromResponse with null-safe field access.