funding

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package funding discovers the funding links a repository advertises, the same way GitHub does for the Sponsor button: a FUNDING.yml file, looked up in the places GitHub looks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func URL

func URL(platform, handle string) string

URL returns the page GitHub links for a handle on a platform, or an empty string for a platform it does not know. Custom entries are already URLs.

Types

type Links struct {
	GitHub          StringList `yaml:"github" json:"github,omitempty"`
	Patreon         string     `yaml:"patreon" json:"patreon,omitempty"`
	OpenCollective  string     `yaml:"open_collective" json:"open_collective,omitempty"`
	KoFi            string     `yaml:"ko_fi" json:"ko_fi,omitempty"`
	Tidelift        string     `yaml:"tidelift" json:"tidelift,omitempty"`
	CommunityBridge string     `yaml:"community_bridge" json:"community_bridge,omitempty"`
	Liberapay       string     `yaml:"liberapay" json:"liberapay,omitempty"`
	IssueHunt       string     `yaml:"issuehunt" json:"issuehunt,omitempty"`
	LFXCrowdfunding string     `yaml:"lfx_crowdfunding" json:"lfx_crowdfunding,omitempty"`
	Polar           string     `yaml:"polar" json:"polar,omitempty"`
	BuyMeACoffee    string     `yaml:"buy_me_a_coffee" json:"buy_me_a_coffee,omitempty"`
	ThanksDev       string     `yaml:"thanks_dev" json:"thanks_dev,omitempty"`
	Otechie         string     `yaml:"otechie" json:"otechie,omitempty"`
	Custom          StringList `yaml:"custom" json:"custom,omitempty"`
}

Links is the parsed content of a FUNDING.yml file.

func Discover

func Discover(ctx context.Context, files forges.FileService, owner, repo, ref string) (Links, error)

Discover reads the funding file GitHub would read for owner/repo; an empty ref reads the default branch, and a missing file moves to the next location.

func Parse

func Parse(content []byte) (Links, error)

Parse reads the body of a FUNDING.yml file. Keys this package does not know are ignored, so a platform added later still parses.

func (Links) Empty

func (l Links) Empty() bool

Empty reports whether the file declared no funding destination.

type StringList

type StringList []string

StringList is a value GitHub accepts either as one entry or as a list of them: "github" and "custom" both allow either.

func (*StringList) UnmarshalYAML

func (l *StringList) UnmarshalYAML(node *yaml.Node) error

Jump to

Keyboard shortcuts

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