repomatic.github.sponsor module¶
Check if a GitHub user is a sponsor of another user or organization.
Uses the GitHub GraphQL API via the gh CLI to query sponsorship data.
Supports both user and organization owners, with pagination for accounts
that have more than 100 sponsors.
When run in GitHub Actions, the owner defaults to
Metadata’s view of the repository; the author
and issue/PR number come from the event-payload readers in
actions.
- repomatic.github.sponsor.get_default_owner()[source]¶
Get the repository owner from CI context.
Delegates to
Metadata.repo_owner.
- repomatic.github.sponsor.SPONSORS_QUERY_TEMPLATE = '\nquery($owner: String!, $cursor: String) {\n %s(login: $owner) {\n sponsorshipsAsMaintainer(first: 100, after: $cursor, includePrivate: true) {\n pageInfo { hasNextPage endCursor }\n nodes { sponsorEntity { ... on User { login } ... on Organization { login } } }\n }\n }\n}\n'¶
GraphQL query for an account’s sponsors, parameterized on the account kind.
The user and organization queries are identical except for the node naming the account (
userororganization), which doubles as the response’s data path:_iter_sponsors()interpolates it into both places.
- repomatic.github.sponsor.get_sponsors(owner: str) frozenset[str][source]¶
Get all sponsors for a user or organization.
Tries the user query first, then falls back to organization query.
Results are cached to avoid redundant API calls within the same process.