Documentation
¶
Overview ¶
Package contributors owns the M4 "contributors" plugin. Per the contract this plugin targets the repository-template account kind, which M4 does not yet support (M7 territory). In M4 it always returns Skipped=true with an explanatory reason.
Index ¶
Constants ¶
const Name = "contributors"
Name is the canonical plugin slug.
Variables ¶
var Plugin plugins.Plugin = &contributorsPlugin{}
Plugin is the singleton registered with the global plugin registry.
Functions ¶
func Partial ¶
Partial renders the classic SVG fragment for the contributors plugin. Upstream classic does not ship a contributors.ejs — contributors is rendered only in the repository template — so we emit a self-contained section with header + per-contributor row (avatar + login, plus commit count and ++/-- diff line counts when contributions mode is enabled) using HTML inside <section>.
Returns "" until contributors.go's Run wires up data (M7 repo-mode is the only path that currently populates List; user/org modes stay Skipped).
Output structure:
<section data-section="contributors">
<h2 class="field"><svg/>N Contributor(s)</h2>
<div class="row"><section>
[for each contributor]:
<div class="field contributor[ contributor-contributions]" data-login="...">
<img class="avatar" src="..."/>
<span class="login">${login}</span>: <span class="contributions">
<span class="commits">${commits} commit(s)</span>
<span class="diff">++${additions} --${deletions}</span>
(or <span class="stats-pending">stats pending</span>
when /stats/contributors returned 202 Accepted)
</span>
</div>
</section></div>
</section>
Note the explicit ": " separator between the login span and the contributions span — without it, an SVG-aware renderer collapses whitespace and the login fuses with the commit count (see #421: "mjun081267 commits" where the "67" is the commit count attached to the avatar label).
Types ¶
type Contributor ¶
type Contributor struct {
Login string `json:"login"`
AvatarURL string `json:"avatarUrl"`
Commits int `json:"commits"`
Additions int `json:"additions"`
Deletions int `json:"deletions"`
}
Contributor mirrors one entry from the upstream contributors list.
type Result ¶
type Result struct {
Skipped bool `json:"skipped,omitempty"`
SkippedReason string `json:"-"`
Mode string `json:"mode,omitempty"`
Contributions bool `json:"contributions"`
List []Contributor `json:"list"`
Sections []string `json:"sections"`
Base string `json:"base"`
Head string `json:"head"`
// StatsPending is true when GET /repos/{owner}/{repo}/stats/contributors
// returned 202 Accepted ("warming up"). The partial uses this to
// render a "stats pending" indicator instead of misleading ++0 --0
// chips when contributions mode is enabled.
StatsPending bool `json:"stats_pending,omitempty"`
}
Result is the JSON payload published under data.Plugins["contributors"].