Skip to content

Commit

Permalink
Merge branch 'dev' into releases/v1
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesIves committed Dec 3, 2023
2 parents 6a447f2 + 01673aa commit 8b513ea
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'Add GitHub Sponsors to Readme'
description: 'This GitHub Action will automatically add your GitHub Sponsors to your README.'
author: 'James Ives <iam@jamesiv.es>'
runs:
using: 'node16'
using: 'node20'
main: 'lib/main.js'
branding:
icon: 'heart'
Expand All @@ -11,7 +11,7 @@ inputs:
token:
description: >
You must provide the action with a Personal Access Token (PAT) with either the user:read or org:read permission scope and store it in the secrets / with menu as a secret.
This should be generated from the account or organization that recieves sponsorship.
This should be generated from the account or organization that receives sponsorship.
[Learn more about creating and using encrypted secrets here.](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)
required: true
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@jamesives/github-sponsors-readme-action",
"description": "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.",
"author": "James Ives <iam@jamesiv.es> (https://jamesiv.es)",
"version": "1.2.2",
"version": "1.3.0",
"license": "MIT",
"main": "lib/lib.js",
"types": "lib/lib.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export interface Sponsor {
}
createdAt: string
privacyLevel: PrivacyLevel
tier: {
tier?: {
monthlyPriceInCents?: number
}
}
Expand Down
10 changes: 6 additions & 4 deletions src/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,17 @@ export function generateTemplate(
let filteredSponsors = sponsorshipsAsMaintainer.nodes.filter(
(user: Sponsor) =>
user.privacyLevel !== PrivacyLevel.PRIVATE &&
(user.tier.monthlyPriceInCents ? user.tier.monthlyPriceInCents : 0) >=
action.minimum
(user.tier && user.tier.monthlyPriceInCents
? user.tier.monthlyPriceInCents
: 0) >= action.minimum
)

if (action.maximum > 0) {
filteredSponsors = filteredSponsors.filter(
(user: Sponsor) =>
(user.tier.monthlyPriceInCents ? user.tier.monthlyPriceInCents : 0) <=
action.maximum
(user.tier && user.tier.monthlyPriceInCents
? user.tier.monthlyPriceInCents
: 0) <= action.maximum
)
}

Expand Down

0 comments on commit 8b513ea

Please sign in to comment.