]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
👷 Refactor FastAPI People Sponsors to use 2 tokens (#13228)
authorSebastián Ramírez <tiangolo@gmail.com>
Sat, 18 Jan 2025 12:58:36 +0000 (12:58 +0000)
committerGitHub <noreply@github.com>
Sat, 18 Jan 2025 12:58:36 +0000 (12:58 +0000)
.github/workflows/sponsors.yml
scripts/sponsors.py

index d2d845b2761a87ea6699f52076d355259747cd50..a5230c83430e381eb276ee1848dda7b6e90d79e8 100644 (file)
@@ -48,4 +48,5 @@ jobs:
       - name: FastAPI People Sponsors
         run: python ./scripts/sponsors.py
         env:
-          GITHUB_TOKEN: ${{ secrets.SPONSORS }}
+          SPONSORS_TOKEN: ${{ secrets.SPONSORS_TOKEN }}
+          PR_TOKEN: ${{ secrets.FASTAPI_PR_TOKEN }}
index ed782a49ee755e1a55ac246e343fad25a10e7449..45e02bd621b191aa38c534defa87e08a7765acef 100644 (file)
@@ -83,7 +83,8 @@ class SponsorsResponse(BaseModel):
 
 
 class Settings(BaseSettings):
-    github_token: SecretStr
+    sponsors_token: SecretStr
+    pr_token: SecretStr
     github_repository: str
     httpx_timeout: int = 30
 
@@ -94,7 +95,7 @@ def get_graphql_response(
     query: str,
     after: str | None = None,
 ) -> dict[str, Any]:
-    headers = {"Authorization": f"token {settings.github_token.get_secret_value()}"}
+    headers = {"Authorization": f"token {settings.sponsors_token.get_secret_value()}"}
     variables = {"after": after}
     response = httpx.post(
         github_graphql_url,
@@ -159,7 +160,7 @@ def main() -> None:
     logging.basicConfig(level=logging.INFO)
     settings = Settings()
     logging.info(f"Using config: {settings.model_dump_json()}")
-    g = Github(settings.github_token.get_secret_value())
+    g = Github(settings.pr_token.get_secret_value())
     repo = g.get_repo(settings.github_repository)
 
     tiers = get_individual_sponsors(settings=settings)