Skip to content

JoshuaKGoldberg/github-sponsors-to-markdown

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GitHub Sponsors to Markdown

Creates a Markdown table summarizing your GitHub sponsors. πŸ’°

All Contributors: 1 πŸ‘ͺ Codecov Test Coverage Contributor Covenant License: MIT Sponsor: On GitHub Style: Prettier TypeScript: Strict npm package version

Usage

npm i github-sponsors-to-markdown
import { githubSponsorsToMarkdown } from "github-sponsors-to-markdown";

console.log(await githubSponsorsToMarkdown());

Note that you'll need a GH_TOKEN environment variable. For example:

gh auth refresh --scopes read:user # Only necessary your first time
GH_TOKEN=$(gh auth token) node build.js

See this in action on github.com/JoshuaKGoldberg! ⚑️

Options

githubSponsorsToMarkdown can be optionally be provided an options object.

await githubSponsorsToMarkdown({
	/* ... */
});
export interface GithubSponsorsToMarkdownOptions {
	auth: string;
	login?: string;
	tiers?: Record<string, SponsorshipTier>;
	verbose?: boolean;
}

export const defaultOptions = {
	tiers: {
		Bronze: {
			minimum: 5,
			size: 25,
		},
		Gold: {
			minimum: 25,
			size: 100,
		},
		Silver: {
			minimum: 10,
			size: 50,
		},
	},
} satisfies GithubSponsorsToMarkdownOptions;

auth

GitHub auth token, such as what's provided by gh auth token.

login

GitHub organization or username to query sponsorships for. If not provided, defaults to querying viewer.

githubSponsorsToMarkdown({
	login: "JoshuaKGoldberg",
});

tier

Custom tiers to render instead of the defaults.

githubSponsorsToMarkdown({
	tiers: {
		"Also Awesome": {
			minimum: 10,
			size: 50,
		},
		Awesome: {
			label: "Best People Ever!",
			minimum: 100,
			size: 100,
		},
	},
});
export interface SponsorshipTier {
	label?: string;
	minimum: number;
	size: number;
}

verbose

Whether to console.log while executing. Useful for debugging unexpected results.

githubSponsorsToMarkdown({
	verbose: true,
});

This will log:

  • The login option
  • The response from querying GitHub's GraphQL API
  • Collected tiers from sponsorship groupings

Development

See .github/CONTRIBUTING.md, then .github/DEVELOPMENT.md. Thanks! πŸ’–

Contributors

Josh Goldberg
Josh Goldberg

πŸ”§ πŸ› πŸ’» 🚧 πŸš‡ πŸ€”

πŸ’™ This package is based on @JoshuaKGoldberg's template-typescript-node-package.

About

Creates a Markdown table summarizing your GitHub sponsors. πŸ’°

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Contributors 3

  •  
  •  
  •