client
repo_scaffold.github_init.client ¶
Thin PyGithub wrapper used by the gh-init orchestrator (and its tests).
Isolating the SDK behind GhInitClient lets the orchestrator depend on a
small, mockable surface instead of github module internals, and lets the
generated tests swap the whole client out without monkey-patching the SDK.
GhInitClient ¶
Tiny PyGithub wrapper that orchestrator and tests both consume.
Construct a client backed by the given personal access token.
Source code in repo_scaffold/github_init/client.py
token
property
¶
The personal access token this client authenticates with.
Exposed so the orchestrator can feed it to the non-interactive
git push / mkdocs gh-deploy subprocesses (see git_push and
deploy_docs), which need it to authenticate an HTTPS remote that has
no credential helper and no TTY.
authenticated_login ¶
Return the login of the token's user. Raises on a bad token.
enable_pages ¶
Configure GitHub Pages to deploy from branch/path.
PyGithub 2.x has no Pages helper, so this calls the REST API directly:
POST .../pages to create the site, falling back to PUT to update
the source when a site already exists.
Source code in repo_scaffold/github_init/client.py
get_or_create_repo ¶
get_or_create_repo(
owner: str | None,
name: str,
*,
description: str,
private: bool,
allow_existing: bool,
) -> Repository
Create the repo on the right account, or look it up if already there.
Source code in repo_scaffold/github_init/client.py
protect_branch ¶
Enable branch protection on branch (requires admin on the repo).
Rules are intentionally compatible with the generated version-bump
workflow: enforce_admins is left off so the release token (owned by
a repo admin) can still push chore(version): commits and tags
directly. Branch protection is unavailable on private repos without a
paid GitHub plan; such a failure surfaces to the caller.
Source code in repo_scaffold/github_init/client.py
set_homepage ¶
set_secret ¶
Create or replace an Actions secret. create_secret is PUT-based.
set_variable ¶
Create an Actions variable, falling back to edit if it exists.