Expand description
Optional private GitHub mirror.
mirror ensures the target GitHub repo exists (creating it under the right
account kind when it doesn’t) and pushes the requested branches to it.
SECURITY — the token must never leak:
- The GitHub REST calls carry the token in the
Authorizationheader, never in a URL or query string, so a formatted request URL is tokenless. - The
git pushcarries the token in an environment variable (GIT_CONFIG_VALUE_0), applied by git as anhttp.extraheader— it is never in the push URL or inargv, so it can’t be seen inps. - Error messages format only
HTTP {status}/ transport kind, never a response body (which could echo request data) and never the token. As defense-in-depth, git’s stderr is scrubbed of the token before it is used.
Structs§
- Token
Check - The result of preflighting a GitHub token against a repo’s mirror config
(
mirror check): whether it authenticates, what it can see, and whether it can push.github/workflows/if the repo ships any.
Enums§
- Repo
Access - A token’s access to the mirror’s target GitHub repo, from
GET /repos/{owner}/{repo}.
Functions§
- branches_
to_ mirror - From the just-updated refs, the short branch names the policy opts into the
mirror: a
refs/heads/<b>update whose<b>appears inconfigured. - check_
token - Preflight
tokenagainstowner/repo: does it authenticate, what scopes does it carry (if introspectable), and what access does it have to the repo. Never returns anErr— a failed call surfaces asvalid: falseorRepoAccess::Errorso the caller can report every check even when one of the two calls fails. - mirror
- Mirror
branchesof the bare repo atrepo_pathtogithub.com/{owner}/{repo_name}, creating the (private-by-default) GitHub repo first if it doesn’t exist.