pub struct GitHub { /* private fields */ }Expand description
The GitHub implementation of RemoteHost, driven through gh.
Every method is one gh invocation, and the program that answers as gh is the
seam a journey substitutes: GitHub’s decisioning is what a test replaces, never
the git underneath it.
Implementations§
Source§impl GitHub
impl GitHub
Sourcepub fn new(repo: impl Into<String>) -> Result<Self>
pub fn new(repo: impl Into<String>) -> Result<Self>
Address this host at one repository, named owner/name.
Checked here rather than at each call: the slug is interpolated into every
gh --repo invocation, and a value that is not one repository is a value
that addresses something nobody asked for.
Trait Implementations§
impl Eq for GitHub
Source§impl RemoteHost for GitHub
impl RemoteHost for GitHub
Source§fn check_log(&self, cr: &ChangeRequest, check: &Check) -> Result<ArtifactId>
fn check_log(&self, cr: &ChangeRequest, check: &Check) -> Result<ArtifactId>
Store one check’s log as an artifact, or refuse.
A fetch that did not produce the log is an error and no artifact: an
artifact reads as what the check printed, so one holding the reason there is
none is a lie in the only record a consumer has. A caller that must not fail
over a missing log declines to fail over this error, as crate::publish
does.
Source§fn describe_change(
&self,
cr: &ChangeRequest,
title: Option<&str>,
body: &str,
) -> Result<()>
fn describe_change( &self, cr: &ChangeRequest, title: Option<&str>, body: &str, ) -> Result<()>
One gh pr edit, handing the body over as a file.
A file rather than --body, because a body is prose of unbounded size and an
argument vector is not where multi-line Markdown belongs: the same reason
onevcs publish takes --body-file. The file is written under a scratch
directory that goes when this returns, and gh reads it before then.
Source§fn change_description(&self, cr: &ChangeRequest) -> Result<Description>
fn change_description(&self, cr: &ChangeRequest) -> Result<Description>
One gh pr view, reading exactly the two fields a description is.
A response missing either is refused rather than read as empty: “the change request has no body” and “the host would not say what the body is” are different facts, and a caller finishing a description off what it reads here would otherwise start from a blank the host never answered.
Source§fn visibility(&self) -> Result<Visibility>
fn visibility(&self) -> Result<Visibility>
One gh api repos/{owner}/{name}, reading the two fields GitHub states a
repository’s visibility in. visibility is public, private or internal,
and an internal repository is private to everybody outside its organisation;
an answer carrying neither field is refused rather than read as either.
Source§fn is_draft(&self, cr: &ChangeRequest) -> Result<bool>
fn is_draft(&self, cr: &ChangeRequest) -> Result<bool>
One gh pr view, reading the one field the host decides a draft by.
A response that does not carry it is refused rather than read as “not a draft”: what this decides is whether a change may be asked to merge, and “could not look” reported as “nothing is holding it” is the one answer that lands work somebody held back.
Source§fn merged_at(&self, cr: &ChangeRequest) -> Result<Option<Sha>>
fn merged_at(&self, cr: &ChangeRequest) -> Result<Option<Sha>>
One gh pr view, reading exactly the two fields a merge is decided from —
the same read merge makes, through the same parser, so watching a change
request and merging one cannot come to disagree about what merged means.
Source§fn merged_head(&self, cr: &ChangeRequest) -> Result<Option<MergedChange>>
fn merged_head(&self, cr: &ChangeRequest) -> Result<Option<MergedChange>>
One gh pr view, reading the two fields a merge is decided from and the head
it was of — the read merged_at makes, through the same
parser, with headRefOid beside it rather than in a second request.
Source§fn merge_time(&self, cr: &ChangeRequest) -> Result<Option<String>>
fn merge_time(&self, cr: &ChangeRequest) -> Result<Option<String>>
One gh pr view, reading exactly the field GitHub records a merge’s time in.
mergedAt is null — or GitHub’s zero time — on a change request that has not
merged, and both read as None.
Source§fn mergeability(&self, cr: &ChangeRequest) -> Result<Mergeability>
fn mergeability(&self, cr: &ChangeRequest) -> Result<Mergeability>
One gh pr view, reading exactly the two fields GitHub decides a merge’s
mergeability by.
mergeable is the answer — MERGEABLE, CONFLICTING, or UNKNOWN while
GitHub has not computed it — and mergeStateStatus is quoted beside it, since
DIRTY is how GitHub spells the same conflict there. A response that carries
no mergeable, or a value GitHub has never answered, is refused rather than
read as either: a conflict nobody reported ends a publication, and a mergeable
change nobody reported hides one.
Source§fn head_activity(&self, cr: &ChangeRequest) -> Result<HeadActivity>
fn head_activity(&self, cr: &ChangeRequest) -> Result<HeadActivity>
Two REST reads about the commit the caller names: the workflow runs on it, and its check suites.
A run counts while its status is anything but completed; a suite counts
while it is not completed and has at least one check run, because GitHub
leaves an installed app’s empty queued suite on every commit for ever. A
credential refused the suites answers from the runs alone, saying so with
complete: false; one refused both reads is the runs’ refusal.
The commit asked about is the caller’s — a watch names the one it pushed — and the commit answered about is read off the records GitHub returned, so a host whose records name another commit says so rather than having this build’s question stamped onto its answer. Reading the change request’s head first would cost a third request on every read and decide nothing these two do not.
Source§fn review_comments(
&self,
change: &ChangeId,
since: Option<&ReadMarker>,
) -> Result<ReviewRead>
fn review_comments( &self, change: &ChangeId, since: Option<&ReadMarker>, ) -> Result<ReviewRead>
One GraphQL query document, paged — see review::github.
Source§fn reply_to_comment(
&self,
change: &ChangeId,
comment: &CommentId,
body: &str,
_key: &str,
) -> Result<PostedReply>
fn reply_to_comment( &self, change: &ChangeId, comment: &CommentId, body: &str, _key: &str, ) -> Result<PostedReply>
One REST request — see review::github.
Source§fn change_standings(
&self,
root: &str,
changes: &[ChangeId],
) -> Result<ChangeStandings>
fn change_standings( &self, root: &str, changes: &[ChangeId], ) -> Result<ChangeStandings>
One aliased GraphQL query per 50 change requests — see standings::github.
Source§fn review_standings(
&self,
root: &str,
changes: &[(ChangeId, Option<ReadMarker>)],
) -> Result<ReviewStandings>
fn review_standings( &self, root: &str, changes: &[(ChangeId, Option<ReadMarker>)], ) -> Result<ReviewStandings>
One aliased GraphQL query per 150 change requests — see standings::github.
Source§fn retarget_change(
&self,
change: &ChangeId,
base: &str,
body: Option<&str>,
) -> Result<ReadCost>
fn retarget_change( &self, change: &ChangeId, base: &str, body: Option<&str>, ) -> Result<ReadCost>
One REST request — see standings::github.
Source§fn reopen_change(&self, change: &ChangeId) -> Result<ReadCost>
fn reopen_change(&self, change: &ChangeId) -> Result<ReadCost>
One REST request — see standings::github.
Source§fn allows_auto_merge(&self) -> Result<bool>
fn allows_auto_merge(&self) -> Result<bool>
One gh repo view, reading the one field GitHub decides it by.
Source§fn authenticated_user(&self) -> Result<String>
fn authenticated_user(&self) -> Result<String>
Source§fn open_change(&self, req: ChangeSpec) -> Result<ChangeRequest>
fn open_change(&self, req: ChangeSpec) -> Result<ChangeRequest>
Source§fn find_changes(&self, head: &str, base: &str) -> Result<Vec<ChangeRequest>>
fn find_changes(&self, head: &str, base: &str) -> Result<Vec<ChangeRequest>>
head into base.Source§fn change_checks(&self, cr: &ChangeRequest) -> Result<ChangeChecks>
fn change_checks(&self, cr: &ChangeRequest) -> Result<ChangeChecks>
Source§fn merge(&self, cr: &ChangeRequest, policy: MergePolicy) -> Result<MergeOutcome>
fn merge(&self, cr: &ChangeRequest, policy: MergePolicy) -> Result<MergeOutcome>
Source§fn ready_for_review(&self, cr: &ChangeRequest) -> Result<()>
fn ready_for_review(&self, cr: &ChangeRequest) -> Result<()>
Source§fn required_checks_on(&self, base: &str) -> Result<RequiredChecks>
fn required_checks_on(&self, base: &str) -> Result<RequiredChecks>
base, asked
of the branch itself rather than of a change request targeting it. Read moreimpl StructuralPartialEq for GitHub
Auto Trait Implementations§
impl Freeze for GitHub
impl RefUnwindSafe for GitHub
impl Send for GitHub
impl Sync for GitHub
impl Unpin for GitHub
impl UnsafeUnpin for GitHub
impl UnwindSafe for GitHub
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.