Return GitHub API auth headers, or None if no token is configured.
()
| 904 | |
| 905 | |
| 906 | def _github_auth_headers() -> dict[str, str] | None: |
| 907 | """Return GitHub API auth headers, or None if no token is configured.""" |
| 908 | token = os.environ.get("GITHUB_TOKEN") or os.environ.get("GH_TOKEN") or "" |
| 909 | token = token.strip() |
| 910 | if not token: |
| 911 | return None |
| 912 | return { |
| 913 | "Authorization": f"Bearer {token}", |
| 914 | "Accept": "application/vnd.github+json", |
| 915 | "X-GitHub-Api-Version": "2022-11-28", |
| 916 | } |
| 917 | |
| 918 | |
| 919 | def _is_git_sha(version: str | None) -> bool: |