Creates a Markdown table summarizing your GitHub sponsors. π°
npm i github-sponsors-to-markdownimport { 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.jsSee this in action on github.com/JoshuaKGoldberg! β‘οΈ
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;GitHub auth token, such as what's provided by gh auth token.
GitHub organization or username to query sponsorships for.
If not provided, defaults to querying viewer.
githubSponsorsToMarkdown({
login: "JoshuaKGoldberg",
});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;
}Whether to console.log while executing.
Useful for debugging unexpected results.
githubSponsorsToMarkdown({
verbose: true,
});This will log:
- The
loginoption - The response from querying GitHub's GraphQL API
- Collected tiers from sponsorship groupings
See .github/CONTRIBUTING.md, then .github/DEVELOPMENT.md.
Thanks! π°
Josh Goldberg π§ π π» π§ π π€ π π π |
π This package was templated with
create-typescript-appusing the Bingo engine.