Repository navigation
feat: rich GitHub previews: state, highlighted code, diff stats and authors - #193
Open
DirkHoffman wants to merge 1 commit into
Open
DirkHoffman wants to merge 1 commit into
DirkHoffman wants to merge 1 commit into
Conversation
DirkHoffman
marked this pull request as ready for review
October 16, 2026 10:41
DirkHoffman
force-pushed
the
feat/github-preview-extras
branch
3 times, most recently
from
October 16, 2026 12:53
ca4f0b5 to
bf1a463
Compare
…uthors Links to GitHub now get a preview built from GitHub's API instead of the page's Open Graph tags, fetched once by the UnfurlLink job when the commit is created: - Pull requests and issues: title, open / closed / merged, author, and the size of a pull request (+48 -3). - Lines of code (blob/<ref>/<path>#L10-L20): the lines themselves, at most 12, highlighted with the same highlighter and theme as code blocks in commits. - Commits: message, author and size. Releases: name. Repositories: description, stars and language. - Authors link to their devnull profile when they are on devnull too. GitHub's shorthands, owner/repo#123 and owner/repo@sha, become links too.
DirkHoffman
force-pushed
the
feat/github-preview-extras
branch
from
October 16, 2026 16:47
bf1a463 to
b5f4c0b
Compare
Member
|
@nunomaduro This PR touches database migrations and new services. Could you take a look? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: rich GitHub previews: state, highlighted code, diff stats and authors
Builds on the link previews from #73 and the highlighting from #124: links to GitHub now get a preview from GitHub's API.
Supersedes #36. The feedback there was right: we should never call GitHub while someone is clicking through the app. So GitHub is now asked once, when the commit is created, as suggested. With
productionmoving this fast it was cleaner to start a fresh PR than to rework #36.1-posting-a-commit.webm
2-scrolling-the-log.webm
Examples
Pull request (

owner/repo#14or a/pull/14link): title, open / closed / merged, author and size.Issue: title, open / closed and author.

Lines of code (

/blob/<ref>/<file>#L 50-L61): the lines themselves (at most 12), highlighted like code blocks in commits (#124).Commit

(
owner/repo@42faad4or a/commit/link): message, author and size.Release: name, released.

Repository: description, stars and language.

Author on devnull: their name links to their devnull profile.

Unknown reference: still a link, but no card.

Not a reference: a plain

owner/repoorand/orisn't linked.Dark mode:

How
UpdateLinkPreview(run by the existingUnfurlLinkjob when the commit is created) asksApp\Services\GitHubPreviewsinstead of fetching the page, and stores the result in a newgithubcolumn onlink_previews. One API call per unique link (two for an issue number that turns out to be a pull request), none while rendering, and large commits and files aren't downloaded in full. Server errors and rate limits are retried, like other link previews (#160). Code is highlighted when shown, like code blocks in commits.UpdateUserSshKeysand this share one API client (App\Services\GitHub, OAuth app auth).Note: the state is a snapshot from when the commit was posted.
Tests cover every link type, the shorthands, code ranges and languages, escaping in highlighted code, bots, unknown references, and retrying on server errors and rate limits. Changed files have 100% coverage.