Struct GhStepBuilder

Source
pub struct GhStepBuilder { /* private fields */ }

Implementations§

Source§

impl GhStepBuilder

Source

pub fn new(display_name: impl AsRef<str>, uses: impl AsRef<str>) -> Self

Creates a new GitHub step builder, with the given display name and action to use. For example, the following code generates the following yaml:

GhStepBuilder::new("Check out repository code", "actions/checkout@v4").finish()
- name: Check out repository code
  uses: actions/checkout@v4

For more information on the yaml syntax for the name and uses parameters, see https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsname

Source

pub fn condition(self, cond: ReadVar<bool>) -> Self

Adds a condition ReadVar<bool> to the step, such that the step only executes if the condition is true. This is equivalent to using an if conditional in the yaml.

For more information on the yaml syntax for if conditionals, see https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsname

Source

pub fn with(self, k: impl AsRef<str>, v: impl Into<GhParam>) -> Self

Adds a parameter to the step, specified as a key-value pair corresponding to the param name and value. For example the following code generates the following yaml:

let (client_id, write_client_id) = ctx.new_secret_var();
let (tenant_id, write_tenant_id) = ctx.new_secret_var();
let (subscription_id, write_subscription_id) = ctx.new_secret_var();
// ... insert rust step writing to each of those secrets ...
GhStepBuilder::new("Azure Login", "Azure/login@v2")
              .with("client-id", client_id)
              .with("tenant-id", tenant_id)
              .with("subscription-id", subscription_id)
- name: Azure Login
  uses: Azure/login@v2
  with:
    client-id: ${{ env.floweyvar1 }} // Assuming the backend wrote client_id to floweyvar1
    tenant-id: ${{ env.floweyvar2 }} // Assuming the backend wrote tenant-id to floweyvar2
    subscription-id: ${{ env.floweyvar3 }} // Assuming the backend wrote subscription-id to floweyvar3

For more information on the yaml syntax for the with parameters, see https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepswith

Source

pub fn output(self, k: impl AsRef<str>, v: WriteVar<String>) -> Self

Specifies an output to read from the step, specified as a key-value pair corresponding to the output name and the flowey var to write the output to.

This is equivalent to writing into v the output of a step in the yaml using: ${{ steps.<backend-assigned-step-id>.outputs.<k> }}

For more information on step outputs, see https://docs.github.com/en/actions/sharing-automations/creating-actions/metadata-syntax-for-github-actions#outputs-for-composite-actions

Source

pub fn run_after(self, side_effect: ReadVar<SideEffect>) -> Self

Specifies a side-effect that must be resolved before this step can run.

Source

pub fn requires_permission( self, perm: GhPermission, value: GhPermissionValue, ) -> Self

Declare that this step requires a certain GITHUB_TOKEN permission in order to run.

For more info about Github Actions permissions, see gh_grant_permissions and https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/assigning-permissions-to-jobs

Source

pub fn finish(self, ctx: &mut NodeCtx<'_>) -> ReadVar<SideEffect>

Finish building the step, emitting it to the backend and returning a side-effect.

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.