Skip to main content

GitHubConfig

Struct GitHubConfig 

Source
#[non_exhaustive]
pub struct GitHubConfig { pub host: String, pub api_base: Url, pub web_base: Url, pub app_id: u64, pub client_id: String, pub app_slug: String, pub jwt_issuer: JwtIssuer, pub checkout_action: String, pub actions_integration_id: Option<u64>, pub request_timeout: Duration, pub device_poll_unit: Duration, pub bridge_checks: bool, }
Expand description

How to reach one GitHub (github.com or a GHES instance) as one App.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§host: String

Forge host resources on this GitHub start with: github.com, or the GHES host.

§api_base: Url

REST API base: https://api.github.com, https://<ghes>/api/v3.

§web_base: Url

Web base, for install pages and the OAuth device flow: https://github.com, https://<ghes>.

§app_id: u64

The App’s numeric id.

§client_id: String

The App’s client id (Iv1.… / Iv23…): the JWT issuer and the device-flow client.

§app_slug: String

The App’s URL slug, for its install page.

§jwt_issuer: JwtIssuer

Which identifier the App JWT is issued under.

§checkout_action: String

uses: reference for checkout in the generated workflow; must be pinned to a 40-hex commit.

§actions_integration_id: Option<u64>

The GitHub Actions App’s id, which the required status check is pinned to. None looks it up (GET /apps/github-actions) when first needed. Pinning matters: an unpinned required check is satisfied by a status anyone with write access posts under that name.

§request_timeout: Duration

Per-request timeout.

§device_poll_unit: Duration

One second of device-flow polling interval, as the adapter waits it. Always one second outside tests.

§bridge_checks: bool

Where no org required workflow is available (personal accounts, organisations without org rulesets), the bridge posts the check itself and the ruleset requires it from this App rather than from GitHub Actions (§9, “forged check runs”): a workflow on another branch can post a “Verify commit trust” run as the Actions App, but not as the community’s App. The plan then commits no workflow. Off by default, so a caller with no check poster keeps the Actions workflow; the bridge turns it on.

Implementations§

Source§

impl GitHubConfig

Source

pub fn github_com( app_id: u64, client_id: impl Into<String>, app_slug: impl Into<String>, ) -> Self

github.com.

Source

pub fn enterprise( host: &str, app_id: u64, client_id: impl Into<String>, app_slug: impl Into<String>, ) -> Result<Self>

A GitHub Enterprise Server instance at host.

Source

pub fn with_endpoints(self, api_base: Url, web_base: Url) -> Self

Point the API and web bases elsewhere (a proxy, a test server). The host that resources must name is unchanged.

Source

pub fn with_app_id_issuer(self) -> Self

Issue App JWTs under the numeric App id instead of the client id.

Source

pub fn with_actions_integration_id(self, id: u64) -> Self

Pin the Actions App id instead of looking it up.

Source

pub fn with_bridge_checks(self) -> Self

Have the bridge post the check itself where there is no org required workflow (see GitHubConfig::bridge_checks).

Trait Implementations§

Source§

impl Clone for GitHubConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GitHubConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more