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 mirrors upstream `org_repo/source/templates/repository/partials/contributors.ejs:25-33`:
<section data-section="contributors">
<h2 class="field"><svg/>Contributors of ${base}</h2>
<div class="row"><section class="contributors fill-width">
[for each contributor]:
<div class="label" data-login="${login}">
<img class="avatar" src="..." width="22" height="22" alt=""/>
${login}
[contributions only]: <div class="contributions">${commits} <svg/></div>
[contributions+stats]: <span class="label-right">++A --D</span>
</div>
</section></div>
</section>
adds/dels stay in a `<span class="label-right">` because upstream's contributors_contributions toggle is not adopted yet; surfacing them as a separate badge keeps the upstream `.contributions` badge unchanged.
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"].