Support GitHub repos in the issues/PRs panel drawer #46
Labels
No labels
bug
docs
enhancement
good first issue
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pedromcaraujo/forge#46
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The panel drawer's issues/PRs tabs (plus the Alt+K
#issue palette) currentlyonly work against Forgejo. Several of my repos live on GitHub — this asks to
teach the panel to speak GitHub too, so a channel can point at a GitHub repo.
Why it's tractable
The feature is well-seamed. The sidecar (
web/panel.py) already normalisesforge JSON into a thinned payload before the browser sees it, and those field
names (
number,title,state,html_url,user.login,labels[].name/.color,PR
draft/base.ref/head.ref, …) match GitHub's API almost exactly. So thefrontend rendering and the whole palette (
#authfilter,#31jump,inject-
#N-into-terminal) should work unchanged once the sidecar returns GitHubdata in the same shape. There's already a plugin seam:
PANEL_RENDERERSinweb/index.htmland thetypeenum in config — nobody's added a secondprovider yet, so it's all hardcoded to
forgejo.What actually differs for GitHub
Concentrated in
web/panel.py:{baseUrl}/api/v1/repos/{owner}/{repo}/…where
baseUrlis also the web UI. GitHub splits them: API atapi.github.com/repos/…, web/html_urlatgithub.com/…. The current codeassumes one
baseUrlserves API, web UI, and attachments — thatassumption needs unpicking.
Authorization: token <t>. GitHub:Bearer <t>./api/v1/markdownwithcapitalised fields
{"Text","Mode","Context"}. GitHub's/markdownislowercase (
{"text","mode","context"}) and rate-limited./attachments/images(#42/#43). GitHub serves user-content from public
*.githubusercontent.com,so the proxy is likely a no-op for GitHub — but the URL-rewriting is keyed on
Forgejo path shapes and needs a GitHub branch (probably passthrough).
Suggested shape
Since GitHub would be the second provider, factor a thin
Providerabstractioninside the sidecar (
list_issues/issue_detail/render_markdown/rewrite_urls) rather than sprinklingif type == "github". Then smalladditions elsewhere:
typeenum inmodules/forge.nixpanelUrlcomputation inmodules/launcher.nixtype === 'forgejo'checks inweb/index.html(registry,channelHasIssues,drawerTitleHref/openIssueInForgejo)renderForgejo, default title)Rough effort: half a day to a day.