Skip to content

Compact sponsor diff and add tier-sum income fallback#65

Open
byte-the-bot wants to merge 4 commits into
mainfrom
fix/sponsors-pr-formatting-and-income
Open

Compact sponsor diff and add tier-sum income fallback#65
byte-the-bot wants to merge 4 commits into
mainfrom
fix/sponsors-pr-formatting-and-income

Conversation

@byte-the-bot
Copy link
Copy Markdown
Contributor

Fixes two issues with the daily sponsors update PR (#64):

Hard-to-review diff

The script wrote the file with JSON.stringify(data, null, 2), which expanded every sponsor object onto five lines. Combined with avatar URLs that change frequently (GitHub appends a ?u=... cache buster), the daily diff became huge.

Replaced the writer with a small custom formatter that keeps each sponsor on a single line, matching the format the file had before automation took over:

"sponsors": [
  { "login": "xtagon", "name": "Justin Workman", "avatarUrl": "..." },
  ...
]

monthlyIncomeEstimate is null

The org-level field monthlyEstimatedSponsorsIncomeInCents returned 0/null, likely because it requires admin scope on the org and the bot's token doesn't have it. But the query already pulls tier.monthlyPriceInDollars per sponsor, which is visible with plain read:org.

Added a fallback that sums those tier prices when the org-level estimate is unavailable. We still prefer the org-level value if it's present, since that's the authoritative number.

Test plan

  • Run the workflow manually (workflow_dispatch) on this branch and confirm the resulting PR has a compact diff and a non-null monthlyIncomeEstimate

The daily sponsors update PR was hard to review because every sponsor
expanded to 5 lines, and monthlyIncomeEstimate showed up as null when
the org-level GraphQL field returned 0 (the field requires admin scope).

- Replace JSON.stringify(data, null, 2) with a custom formatter that
  keeps each sponsor on a single line, matching the original format.
- Fall back to summing tier.monthlyPriceInDollars across sponsors when
  monthlyEstimatedSponsorsIncomeInCents is unavailable; the per-sponsor
  tier data is already in the query and is visible to read:org tokens.
@byte-the-bot byte-the-bot requested a review from a team as a code owner May 1, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant