Skip to main content

ForgeHooks

Trait ForgeHooks 

Source
pub trait ForgeHooks: Send + Sync {
    // Provided methods
    fn before_create(&self, _spec: &RepoSpec) -> HookDecision<RepoSpec> { ... }
    fn after_create(
        &self,
        _state: &RepoState,
    ) -> HookDecision<Vec<BootstrapStep>> { ... }
    fn before_apply_roles(
        &self,
        _repo: &Resource,
        _desired: &[RoleAssignment],
    ) -> HookDecision<Vec<RoleAssignment>> { ... }
    fn after_bootstrap(
        &self,
        _repo: &Resource,
        _outcomes: &[(String, StepOutcome)],
    ) -> HookDecision<Vec<BootstrapStep>> { ... }
    fn on_event(&self, _event: &ForgeEvent) -> HookDecision<ForgeEvent> { ... }
    fn on_drift(
        &self,
        _repo: &Resource,
        _drift: &[Drift],
    ) -> HookDecision<Vec<Drift>> { ... }
}
Expand description

Optional per-adapter hooks. Every method defaults to HookDecision::Continue; an adapter overrides only what its forge does differently.

Provided Methods§

Source

fn before_create(&self, _spec: &RepoSpec) -> HookDecision<RepoSpec>

Before a repository is created. Modify replaces the spec.

Source

fn after_create(&self, _state: &RepoState) -> HookDecision<Vec<BootstrapStep>>

After a repository is created. Modify adds steps for the core to run before the bootstrap plan (Forgejo sets fast-forward-only merges here).

Source

fn before_apply_roles( &self, _repo: &Resource, _desired: &[RoleAssignment], ) -> HookDecision<Vec<RoleAssignment>>

Before roles are converged. Modify replaces the desired set.

Source

fn after_bootstrap( &self, _repo: &Resource, _outcomes: &[(String, StepOutcome)], ) -> HookDecision<Vec<BootstrapStep>>

After a bootstrap plan ran. Modify adds follow-up steps.

Source

fn on_event(&self, _event: &ForgeEvent) -> HookDecision<ForgeEvent>

On a verified event. Modify replaces it; Abort drops it.

Source

fn on_drift( &self, _repo: &Resource, _drift: &[Drift], ) -> HookDecision<Vec<Drift>>

On drift found for a repository. Modify replaces the list (to suppress a forge’s known false positives).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§