Compact sponsor diff and add tier-sum income fallback#65
Open
byte-the-bot wants to merge 4 commits into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
monthlyIncomeEstimateisnullThe org-level field
monthlyEstimatedSponsorsIncomeInCentsreturned 0/null, likely because it requires admin scope on the org and the bot's token doesn't have it. But the query already pullstier.monthlyPriceInDollarsper sponsor, which is visible with plainread: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
workflow_dispatch) on this branch and confirm the resulting PR has a compact diff and a non-nullmonthlyIncomeEstimate