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 chips. Each chip contains the avatar and login; contributions mode adds a right-side commit count badge and optional ++/-- diff badge.
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/>Contributors of ${base}</h2>
<div class="row"><section class="field center horizontal-wrap fill-width">
[for each contributor]:
<span class="label label-flex contributor[ contributor-contributions]">
<img class="avatar" src="..."/><span class="login">${login}</span>
[contributions only]: <span class="label-right">${commits}</span>
[contributions only]: <span class="label-right">++A --D</span>
</span>
</section></div>
</section>
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"].