contributors

package
v1.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const Name = "contributors"

Name is the canonical plugin slug.

Variables

View Source
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"].

func (*Result) IsSkipped

func (r *Result) IsSkipped() bool

IsSkipped lets the classic dispatcher detect the skipped path.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL