Keeping sponsor lists up-to-date across multiple READMEs and websites is tedious - so I wrote a tool to automate it.

goreleaser/sponsors fetches sponsors from GitHub Sponsors and OpenCollective, and renders them into your files using Go templates.

It works in two steps:

# fetch and write sponsors.json
sponsors generate --config sponsors.yml sponsors.json

# render templates into files between comment markers
sponsors apply sponsors.json readme.tpl.md README.md

The apply command looks for comment markers and replaces anything between them:

<!-- sponsors:begin -->

this will be replaced :)

<!-- sponsors:end -->

Templates receive .Sponsors, .Tiers, and .ByTier, so you can render different sections for different tiers:

{{- template "tier" (dict "size" 96 "sponsors" (index .ByTier "gold")) -}}

In the end, you can get results like this, fully automated:

The results

The results

Shared configuration

It is really useful to share configurations, and because of that, sponsors also supports using configuration files and templates from URLs like gh://, https://, and http://.

You can reference files directly from GitHub:

sponsors generate --config gh://goreleaser/.github/sponsors.yml sponsors.json
sponsors apply sponsors.json gh://goreleaser/.github/sponsors.tpl.md README.md

In goreleaser, all repositories share the same sponsors.yml and template from the goreleaser/.github repository.1

Then, in each repository, we run the generate and apply commands above, updating the files we need.

A scheduled GitHub Actions workflow runs it daily and auto-commits the result. No manual work needed.

Warning

Make sure to add sponsors.json to the .gitignore, otherwise you might accidentally commit a file with potentially sensitive data!

Automating it with GitHub Actions

Here’s a workflow that runs daily and auto-commits any changes:

# .github/workflows/sponsors.yml
name: sponsors

on:
  schedule:
    - cron: "0 6 * * *"
  workflow_dispatch:

permissions:
  contents: write

jobs:
  sponsors:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npx @goreleaser/sponsors generate --config sponsors.yml sponsors.json
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      - run: npx @goreleaser/sponsors apply sponsors.json sponsors.tpl.md README.md
      - uses: stefanzweifel/git-auto-commit-action@v5
        with:
          commit_message: "chore: update sponsors"

Tip

npx is used here because it works out of the box in GitHub actions, but any installation method should work.

Install

In case you want to give it a try:

# brew:
brew install --cask goreleaser/tap/sponsors

# npm:
npm install -g @goreleaser/sponsors

# go:
go install github.com/goreleaser/sponsors@latest

Or, if you want to check out the source:

goreleaser/sponsors


  1. The files are sponsors.yml and sponsors.tpl.md↩︎