Skip to main content

Module github

Module github 

Source
Expand description

GitHub review source.

Auth: config token, then token_cmd, then $GITHUB_TOKEN, then gh auth token. GitHub’s search API requires auth to use the @me qualifier, so a missing token is a hard error here (unlike myqonly, which runs unauthenticated and accepts the rate limits).

Queue: GET /search/issues?q=review-requested:@me type:pr is:open archived:false, plus the ignore_repos/ignore_authors/ignore_teams/include_drafts filters from crate::config::GithubConfig folded directly into q (mirroring myqonly’s approach of letting GitHub’s own search syntax do the filtering). Paginated. Each result’s html_url (https://github.com/{owner}/{repo}/pull/{number}) gives an unambiguous review id - {owner}/{repo}/{number} - since owner/repo names can’t themselves contain /. Then GET /repos/{owner}/{repo}/pulls/{number} for head.sha, head.ref, head.repo.clone_url, head.repo.owner.login, and base.repo.clone_url.

Diffstat: review_from_pull also fetches (paginated) GET /repos/{owner}/{repo}/pulls/{number}/files for the per-file filename/additions/ deletions breakdown - one extra request per review, paid during rq sync rather than by rq show’s TUI. If that call fails (rate limit, permissions), it falls back to the aggregate-only additions/deletions/changed_files already on the pull object fetched above (present only on the single-PR fetch, not the search results) rather than showing no diffstat at all.

Checkout is Checkout::Ref { refspec: "refs/pull/{n}/head", commit: head.sha, fork }. refspec is fetched from the base repo (GitHub exposes refs/pull/N/head there for any PR), so the git backend never needs a remote for the fork. fork is Some(ForkRef { remote_name: head.repo.owner.login, remote_url: head.repo.clone_url, branch: head.ref }), used only by the jj backend - remote_name becomes "origin" instead when the fork URL normalizes to the canonical repo’s own origin (a same-repo branch PR). fork is None when head.repo is null (source fork deleted). checkout_spec/fetch_status independently re-fetch the pull from its id rather than caching data from fetch_queue, so they stay correct even if called much later against stale state.

fetch_status: GET /repos/{owner}/{repo}/pulls/{n} for each tracked PR. state == "closed" (merged or not) counts as Lifecycle::Resolved.

Structs§

GithubSource

Constants§

NAME
This source’s hardcoded id-namespace prefix - see crate::state::ReviewKey.