Classes
GitHubSource
Content source for GitHub repositories.
Fetches markdown files from a GitHub repo using the GitHub…
GitHubSource
Content source for GitHub repositories.
Fetches markdown files from a GitHub repo using the GitHub API. Supports both public repos and private repos with token authentication.
Configuration:
repo: str - Repository in "owner/repo" format (required)
branch: str - Branch name (default: "main")
path: str - Directory path within repo (default: "")
token: str - GitHub token (optional, uses GITHUB_TOKEN env var)
glob: str - File pattern to match (default: "*.md")
ContentSourceMethods 4
fetch_all
async
Fetch all markdown files from the repository.
fetch_all
async async def fetch_all(self) -> AsyncIterator[ContentEntry]
Fetch all markdown files from the repository.
Returns
AsyncIterator[ContentEntry]
fetch_one
async
Fetch a single file by path.
fetch_one
async async def fetch_one(self, id: str) -> ContentEntry | None
Fetch a single file by path.
Parameters 1
id |
str |
Relative path within the configured path |
Returns
ContentEntry if found, None otherwiseContentEntry | None
—
get_last_modified
async
Get latest commit time for the configured path.
get_last_modified
async async def get_last_modified(self) -> datetime | None
Get latest commit time for the configured path.
Returns
Datetime of most recent commit or Nonedatetime | None
—
is_changed
async
Check if repo has changed since last fetch.
Uses latest commit SHA for the path.
is_changed
async async def is_changed(self, cached_checksum: str | None) -> bool
Check if repo has changed since last fetch.
Uses latest commit SHA for the path.
Parameters 1
cached_checksum |
str | None |
Previous commit SHA |
Returns
True if changed or unknownbool
—
Internal Methods 2
__init__
Initialize GitHub source.
__init__
def __init__(self, name: str, config: dict[str, Any]) -> None
Initialize GitHub source.
Parameters 2
name |
str |
Source name |
config |
dict[str, Any] |
Configuration with 'repo' required |
_fetch_file
async
Fetch a single file from GitHub.
_fetch_file
async async def _fetch_file(self, session: aiohttp.ClientSession, path: str, sha: str | None) -> ContentEntry | None
Fetch a single file from GitHub.
Parameters 3
session |
aiohttp.ClientSession |
aiohttp session |
path |
str |
Full path within repo |
sha |
str | None |
Git SHA (optional, for cache key) |
Returns
ContentEntry or NoneContentEntry | None
—