Documentation
¶
Overview ¶
Package stars owns the M4 "stars" plugin. It fetches the user's most-recently starred repositories via GraphQL `user.starredRepositories(orderBy: STARRED_AT)`.
Index ¶
Constants ¶
const Name = "stars"
Name is the canonical plugin slug.
Variables ¶
var Plugin plugins.Plugin = &starsPlugin{}
Plugin is the singleton registered with the global plugin registry.
Functions ¶
func Partial ¶
Partial renders the classic SVG fragment for the stars plugin. Mirrors upstream org_repo/source/templates/classic/partials/stars.ejs.
Output structure:
<section data-section="stars">
<h2 class="field"><svg star/>Recently starred repositories</h2>
<div class="row">
<section class="largeable-flex-wrap">
[for each repo]:
<div class="row fill-width largeable-width-half">
<section class="repository">
<div class="field"><svg repo/><div class="name">
<span>${nameWithOwner}</span>
<span>starred ${date}</span>
</div></div>
<div class="field description">${description}</div>
<div class="field infos">
[if language]: <div class="language"><svg dot/>${name}</div>
[if license]: <div><svg law/>${license}</div>
<div><svg star/>${stars}</div>
<div><svg fork/>${forks}</div>
<div><svg issue/>${issues}</div>
<div><svg pr/>${pullRequests}</div>
</div>
</section>
</div>
</section>
</div>
</section>
The full info row (language color, license, forks, open issues, PRs) mirrors upstream EJS lines 32-61 — the data now comes from the extended UserStarredRepositories GraphQL query (#469).
func SetNowForTest ¶ added in v1.2.0
SetNowForTest overrides the stars partial clock and returns a restore function.
Types ¶
type Language ¶ added in v1.1.0
Language is the per-repository primary language name + GitHub color.
type Result ¶
type Result struct {
Skipped bool `json:"skipped,omitempty"`
SkippedReason string `json:"-"`
List []StarredRepo `json:"list"`
Limit int `json:"limit"`
}
Result is the JSON payload published under data.Plugins["stars"].
type StarredRepo ¶
type StarredRepo struct {
NameWithOwner string `json:"nameWithOwner"`
Description string `json:"description"`
URL string `json:"url,omitempty"`
IsFork bool `json:"isFork,omitempty"`
Stars int `json:"stars"`
Forks int `json:"forks"`
Issues int `json:"issues"`
PullRequests int `json:"pullRequests"`
Language *Language `json:"language,omitempty"`
License string `json:"license,omitempty"`
StarredAt time.Time `json:"starredAt"`
}
StarredRepo carries one entry from the upstream starred list.