contributors

package
v1.2.12 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 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 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"].

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