Skip to content

feat(repo-cache): sync pre-fetched repositories without listing the organization #28

Description

@AlexanderLanin

Problem

Following #27, repo_cache.sync_org() correctly reports empty repositories separately from synchronization failures. However, it always lists the organization through gh and accepts only repository-name filters.

Consumers such as generate-repo-overview already fetch the complete repository set through PyGithub. They need to synchronize those same repositories, but using sync_org() causes a second organization listing and loses the already-fetched repository records.

Proposed change

Add a high-level synchronization API that accepts repository records supplied by the caller, for example:

sync_repositories(
    *,
    org: str,
    repositories: Sequence[Repository],
    cache_dir: Path,
    workers: int = DEFAULT_SYNC_WORKERS,
    progress: Callable[[str], None] | None = None,
) -> SyncReport

sync_org() should retain its current behavior and delegate to this API after listing and filtering repositories.

Acceptance criteria

  • Callers can synchronize a pre-fetched sequence of repo_cache.Repository records without another organization-list API request.
  • The returned SyncReport preserves the post-feat(repo-cache): handle empty repositories #27 empty-repository and failure classification.
  • Checkout paths and outcome ordering remain deterministic and compatible with sync_org().
  • sync_org() behavior remains unchanged and shares the implementation.
  • The library documentation includes the pre-fetched-repository use case.

This would let downstream collectors fetch GitHub metadata once, synchronize checkouts once, and pass the resulting paths into their own processing workers.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions