Skip to main content

ProtectionSpec

Struct ProtectionSpec 

Source
#[non_exhaustive]
pub struct ProtectionSpec { pub required_check: String, pub require_pull_request: bool, pub block_force_push: bool, pub block_deletion: bool, pub require_status_check: bool, pub require_code_owner_review: bool, pub protected_paths: Vec<String>, }
Expand description

Branch protection to enforce on the default branch.

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.
§required_check: String

The status check that must pass.

§require_pull_request: bool

Changes must come through a pull request.

§block_force_push: bool

Block force-pushes.

§block_deletion: bool

Block deletion.

§require_status_check: bool

Require ProtectionSpec::required_check in this rule. false when the check is enforced at the namespace level instead (a required workflow, StepAction::RequireNamespaceWorkflow), so this rule carries only the PR, force-push and deletion parts.

§require_code_owner_review: bool

Pull requests need an approving review, including a code owner’s for files that have one (StepAction::RequireOwnerReview).

§protected_paths: Vec<String>

Paths (forge glob syntax) a pull request may not change and still merge: the workflows and the exempt keyring. Without this a PR could rewrite the check it is judged by — CI runs the PR’s own copy of the workflow — and pass itself. Empty where the forge enforces this some other way or not at all.

Implementations§

Source§

impl ProtectionSpec

Source

pub fn standard(check: impl Into<String>) -> Self

The §5.3 protection: PR required, check required, no force-push, no deletion. There is deliberately no bypass field — the design allows no bypass actors, so there is nothing to configure.

Source

pub fn with_protected_paths<I, S>(self, paths: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Also forbid pull requests that change paths.

Source

pub fn with_check_enforced_by_namespace(self) -> Self

Leave the check out of this rule: a namespace-level required workflow enforces it.

Source

pub fn with_code_owner_review(self) -> Self

Require an approving review, and a code owner’s where one is named.

Trait Implementations§

Source§

impl Clone for ProtectionSpec

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 ProtectionSpec

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ProtectionSpec

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for ProtectionSpec

Source§

impl PartialEq for ProtectionSpec

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ProtectionSpec

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ProtectionSpec

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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.