Repository navigation
feat: link GitHub references in commits and show a live card - #36
Closed
DirkHoffman wants to merge 1 commit into
Closed
DirkHoffman wants to merge 1 commit into
DirkHoffman wants to merge 1 commit into
Conversation
Author
Author
|
It probably at somepoint does need an api key, but nuno will never leak those so we are good ;) |
Commits that mention a GitHub repository, issue, pull request, release or commit now render those references as links, and the first one as a small card with live details from the GitHub API (title, state, stars, language). References that don't exist on GitHub keep their link but get no card.
DirkHoffman
force-pushed
the
feat/github-context
branch
from
October 15, 2026 14:04
c81cf46 to
c2f8347
Compare
Member
|
can you do that when we first create the commit and not at runtime? |
nunomaduro
self-requested a review
October 15, 2026 14:49
nunomaduro
marked this pull request as draft
October 15, 2026 14:49
Member
|
Before we consider your pull request today, can you fix the conflicts? Thank you! |
Author
|
Closing this one. The feedback was right: GitHub shouldn't be called while people browse the app. With production moving this fast, a fresh PR is cleaner: it builds on the link previews from #73 and asks GitHub once, when the commit is created. It follows shortly. |
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.



What this does
When a commit mentions something on GitHub, devnull now turns it into a link and shows a small card with live details from GitHub. A commit like "Finally merged laravel/framework#5123" now tells you what was merged, and whether it's still open, merged or closed, without leaving devnull.
What gets recognized
https://github.com/laravel/frameworkhttps://github.com/laravel/framework/issues/1orlaravel/framework#1https://github.com/laravel/framework/pull/1https://github.com/laravel/framework/releases/tag/v13.0.0https://github.com/laravel/framework/commit/42faad4…orlaravel/framework@42faad4laravel/framework#1).owner/repois not linked on its own. Too many normal words look like that (and/or,client/server). Paste the URL instead.How it works
App\Services\GitHubReferencefinds references in text. Each supported format is one regex in a list, checked against whole words, so trailing punctuation like(…)or.is ignored.App\Actions\AttachGitHubContexttakes a page of commits and adds two fields to each one:github_linksandgithub_card.LogControllerandUserControllerpass their paginated commits through it.Http::pool), with a 2s connect timeout and a 3s timeout. Results are cached for 10 minutes. A reference that appears in several commits is fetched once.score 3/4#1, doesn't get an empty card.LinkedTextrenders the links (React elements only, nodangerouslySetInnerHTML) andGitHubCardrenders the card. Colors reuse the existing lane colors.Configuration
GITHUB_TOKENis optional. Without it GitHub allows 60 requests per hour, which is fine locally because of the cache. In production, set a token with no scopes (public data only) to raise that to 5,000 per hour:Trying it locally
php artisan migrate:fresh --seednow also seeds a handful of commits that reference real repositories, issues, pull requests, releases and commits, plus one reference that doesn't exist (it gets a link but no card) and oneand/orthat should not be linked.Tests
GitHubReferenceTest: every supported format, text that must not match, deduplication and order, and punctuation.AttachGitHubContextTest: a card for each kind of reference, the fallback on a server error or a failed connection, no card for a reference that doesn't exist, caching for 10 minutes, retrying after a minute, one request for a shared reference, the token header, and no requests for commits without references.LogControllerTestandUserControllerTest: one test each to prove the wiring.The full suite passes with 100% code coverage and 100% type coverage. PHPStan, Pint, Rector,
tscand the linter pass for the changed files.Ideas for later
Kept out of this PR to keep it small:
Cache::flexible()(stale-while-revalidate), or warm the cache in a queued job when a commit is created, so a cold cache never slows down a page./tree/main/src,/blob/…or/pull/1/filescould become plain links without a card.Mentions and hashtags are not part of this. They're on the "not now" list in
PRODUCT.md. The words "stars" and "pull request" on the cards describe GitHub's own objects; they aren't new devnull features.