fix(ci): use default token for sponsors workflow checkout#62
Merged
Conversation
The update-sponsors workflow used SPONSORS_TOKEN (a user PAT scoped for
the Sponsors GraphQL API) as the checkout token. That PAT has no push
rights on the repo, so `actions/checkout` failed with:
fatal: could not read Username for 'https://github.com':
terminal prompts disabled
Default GITHUB_TOKEN already has the right scope thanks to
`permissions: contents: write` on the job. SPONSORS_TOKEN now only
gates the GraphQL request, which is its actual purpose.
While here:
- Add a User-Agent header (GitHub requires one and rejects unidentified
requests with 403).
- Switch `sponsor` → `sponsorEntity` (supports User and Organization
sponsors) and inline `avatarUrl(size: 60)` instead of `&s=60`.
- Surface GraphQL/HTTP errors via `::error::` annotations and fail fast
on empty token, empty org data, or a missing marker block.
- Stop trying to update a non-existent README_GER.md.
- Emit a placeholder comment between the markers when there are no
sponsors (avoids two adjacent identical markers, which would break
the next run's regex).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Moritz Kohm <moritz.kohm@gmail.com>
Signed-off-by: Musiker15 <info@musiker15.de>
The first PR landed the checkout fix but the run still failed in the GraphQL step with `ValueError: Invalid header value b'bearer ***'` — python's http.client refuses headers containing `\r` or `\n`. The token was likely pasted from a browser that wrapped it, leaving an internal newline that `.strip()` doesn't touch. Use `''.join(token.split())` to scrub all whitespace (a GitHub PAT never contains any), then explicitly fail with a clear `::error::` if the cleaned token differs from `.strip()`-only or looks too short. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Moritz Kohm <moritz.kohm@gmail.com> Signed-off-by: Musiker15 <info@musiker15.de>
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.
Summary
Previous run failed in the checkout step:
Root cause:
actions/checkoutwas given${{ secrets.SPONSORS_TOKEN }}, butthat secret is a user PAT scoped for the GitHub Sponsors GraphQL API — it has
no
contents: writeon the repo, sogit fetchcouldn't authenticate.The job already declares
permissions: contents: write, so the defaultGITHUB_TOKENis exactly what we want for the checkout + push.SPONSORS_TOKENnow only gates the GraphQL request, which is its actual purpose.
Changes
with: { token: ${{ secrets.SPONSORS_TOKEN }} }on the checkout step.User-Agentheader (GitHub rejects unidentified GraphQL requests with 403).sponsor→sponsorEntity(handles both User and Organization sponsors) andinline
avatarUrl(size: 60)instead of&s=60.::error::annotations.README_GER.md(doesn't exist).Test plan
Update Sponsors in READMEworkflow(
gh workflow run update-sponsors.yml) and confirm it completes successfully<!-- sponsors -->block inREADME.md (current single sponsor
cashbankssshould remain — they are theonly known sponsor of MSK-Scripts)
If the GraphQL call still fails after this PR, the new
::error::annotationswill pinpoint whether it's the token scope (
read:user/read:org) orsomething else.
🤖 Generated with Claude Code