INNER CODE UNIT · Python
github_api_request
nolabs-ai/deepfabric · tools-sdk/components/github/app.py:103
def github_api_request(endpoint: str, method: str = "GET", body: dict | None = None) -> dict:
"""Make a request to the GitHub API using Spin's native HTTP client.
Args:
endpoint: API endpoint (e.g., "/repos/owner/repo/contents/path")
method: HTTP method
body: Request body for POST/PATCH requests
Returns:
API response as dict
Raises:
Exception: On API errors
"""
token = get_github_token()
if not token or token == "{{ github_token }}": # noqa: S105
raise ValueError("GitHub token not configured. Set SPIN_VARIABLE_GITHUB_TOKEN.")