Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork18
❤️ This GitHub Action will automatically add your GitHub Sponsors to your README. It can be configured in multiple ways allowing you to display and breakdown your sponsors by price tier with fallbacks.
License
JamesIves/github-sponsors-readme-action
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
ThisGitHub Action will automatically add yourGitHub Sponsors to your README. It can be configured in multiple ways allowing you to display and breakdown your sponsors by price tier with fallbacks. It also includes templating support so you can display your sponsors how you'd like.
Maintenance of this project is made possible by all thecontributors andsponsors. If you'd like to sponsor this project and have your avatar or company logo appear belowclick here. 💖
You can include the action in your workflow to trigger on any event thatGitHub Actions supports.
Important
You'll need to provide the action with aPersonal Access Token (PAT) scoped toread:user andread:org.
Additionally, this action only applies the template within the workspace. You will need to combine it with a deployment action in order to commit it to your project. You can see a full example of this below.
name:Generate Sponsors READMEon:workflow_dispatch:schedule: -cron:30 15 * * 0-6permissions:contents:writejobs:deploy:runs-on:ubuntu-lateststeps: -name:Checkout 🛎️uses:actions/checkout@v2 -name:Generate Sponsors 💖uses:JamesIves/github-sponsors-readme-action@v1with:token:${{ secrets.PAT }}file:'README.md'# ⚠️ Note: You can use any deployment step here to automatically push the README# changes back to your branch. -name:Deploy to GitHub Pages 🚀uses:JamesIves/github-pages-deploy-action@v4with:branch:mainfolder:'.'
You'll also need to add the following<!-- sponsors --><!-- sponsors --> in your.md file so the action knows where to place the data.
#Awesome ProjectGo you!##SponsorsThese are our really cool sponsors!<!-- sponsors--><!-- sponsors-->
Tip
Looking for a more guided walkthrough?Check out the following article for more details on how to set everything up in your project.
If you'd like to use the functionality provided by this action in your own action you can eithercreate a composite action, or you can install it usingyarn ornpm by running the following commands. It's available on both thenpm andGitHub registry.
yarn add @jamesives/github-sponsors-readme-actionnpm install @jamesives/github-sponsors-readme-actionIt can then be imported into your project like so.
importrunfrom'@jamesives/github-sponsors-readme-action'run({token:process.env.GITHUB_TOKEN})
Calling the functions directly will require you to pass in an object containing the variables found in theconfiguration section.
Thewith portion of the workflowmust be configured before the action will work. You can add these in thewith section found in the examples above. Anysecrets must be referenced using the bracket syntax and stored in the GitHub repository'sSettings/Secrets menu. You can learn more about setting environment variables with GitHub actionshere.
The following options must be configured.
| Key | Value Information | Type | Required |
|---|---|---|---|
token | You must provide the action with a Personal Access Token (PAT) with theread:user andread:org permission scope and store it in thesecrets / with menuas a secret. This should be generated from the account or organization that receives sponsorship, and depending on your use case you may need to provide additional scopes.Learn more about creating and using encrypted secrets here. | with | Yes |
file | This should point to the file that you're generating, for exampleREADME.md orpath/to/CREDITS.md. Defaults toREADME.md if no value is provided. | with | Yes |
| Key | Value Information | Type | Required |
|---|---|---|---|
organization | If you're displaying sponsorship information as or for an organization you should toggle this option totrue. You also need to provide the action with anread:org andread:user scoped PAT.Note: The PAT must belong to an owner of the organization. | with | No |
minimum | Using this input you can set the minimum sponsorship threshold. For example setting this to500 will only display sponsors who give of$5 USD and more. By default the action will display all of your sponsors. | with | No |
maximum | Using this input you can set the maximum sponsorship threshold. For example setting this to500 will only display sponsors who give of$5 USD and less. By default the action will display all of your sponsors. | with | No |
marker | This allows you to modify the marker comment that is placed in your file. By default this is set to sponsors -<!-- sponsors --> <!-- sponsors -->, if you set this togold for example you can place<!-- gold --> <!-- gold --> in your file. | with | No |
fallback | Allows you to specify a fallback if you have no sponsors. By default nothing is displayed. | with | No |
template | Allows you to modify the default template. Please refer to thetemplate section of this README for more information. | with | No |
active-only | If set tofalse, inactive sponsors will be displayed. This can be useful if you want to display all sponsors, regardless of their status. By default this is set totrue. | with | No |
include-private | If set totrue, private sponsors will be displayed in the list, however any identifying information will be redacted. This can be useful if you want to display all sponsors, regardless of their privacy settings. | with | No |
The action will export a step output assponsorship-status that you can use in your workflow to determine if the task was successful or not. You can find an explanation of each status type below.
| Status | Description |
|---|---|
success | Thesuccess status indicates that the action was able to successfully generate the README. |
failed | Thefailed status indicates that the action encountered an error while trying to generate the README. |
skipped | Theskipped status indicates that the action could not locate the markers in your .md file. |
running | Therunning status indicates that the action is actively working. |
You can modify the template that gets generated in your file by using thetemplate input. This input allows you to leverage mustache templating to modify what is displayed. The following values are available.
| Status | Description |
|---|---|
name | The users full name. This can sometimes benull if the user hasn't set one. This can be accessed using{{ name }} |
login | The users login, this can be accessed using{{ login }} |
url | The users GitHub profile url, this can be accessed using{{ url }}. |
avatarUrl | The users avatar url, this can be accessed using{{ avatarUrl }}. |
websiteUrl | The users website url. This can sometimes benull if the user hasn't set one, if so this field will fall back tourl. This can be accessed using{{ websiteUrl }}. |
You're able to use markdown or GitHub approved basic HTML. The default template can be foundhere.
You can view a full example of this here.
name:Generate Sponsors READMEon:push:branches: -mainpermissions:contents:writejobs:deploy:runs-on:ubuntu-lateststeps: -name:Checkout 🛎️uses:actions/checkout@v2 -name:Generate Sponsors 💖uses:JamesIves/github-sponsors-readme-action@v1with:token:${{ secrets.PAT }}file:'README.md'template:'* [{{ name }}]({{ url }}) - {{ login }}' -name:Deploy to GitHub Pages 🚀uses:JamesIves/github-pages-deploy-action@v4with:branch:mainfolder:'.'
#Awesome ProjectGo you!##SponsorsThese are our really cool sponsors!<!-- sponsors--><!-- sponsors-->
If you'd like to highlight certain users who contribute to a specific sponsorship tier you can do so using a combination of theminimum,maximum andmarker inputs. Theminimum / maximum inputs equal their dollar contribution in cents.
You can view a full example of this here.
name:Generate Sponsors READMEon:push:branches: -mainpermissions:contents:writejobs:deploy:runs-on:ubuntu-lateststeps: -name:Checkout 🛎️uses:actions/checkout@v2 -name:Generate Sponsors 💖uses:JamesIves/github-sponsors-readme-action@v1with:token:${{ secrets.PAT }}file:'README.md'minimum:500maximum:999marker:'silver' -name:Generate Sponsors 💖uses:JamesIves/github-sponsors-readme-action@v1with:token:${{ secrets.PAT }}file:'README.md'minimum:1000marker:'gold' -name:Deploy to GitHub Pages 🚀uses:JamesIves/github-pages-deploy-action@v4with:branch:mainfolder:'.'
#Awesome ProjectGo you!##Gold Sponsors<!-- gold--><!-- gold-->##Silver Sponsors<!-- silver--><!-- silver-->
About
❤️ This GitHub Action will automatically add your GitHub Sponsors to your README. It can be configured in multiple ways allowing you to display and breakdown your sponsors by price tier with fallbacks.
Topics
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Contributors8
Uh oh!
There was an error while loading.Please reload this page.






















