pub struct GhStepBuilder { /* private fields */ }
Implementations§
Source§impl GhStepBuilder
impl GhStepBuilder
Sourcepub fn new(display_name: impl AsRef<str>, uses: impl AsRef<str>) -> Self
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
Sourcepub fn condition(self, cond: ReadVar<bool>) -> Self
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
Sourcepub fn with(self, k: impl AsRef<str>, v: impl Into<GhParam>) -> Self
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
Sourcepub fn output(self, k: impl AsRef<str>, v: WriteVar<String>) -> Self
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
Sourcepub fn run_after(self, side_effect: ReadVar<SideEffect>) -> Self
pub fn run_after(self, side_effect: ReadVar<SideEffect>) -> Self
Specifies a side-effect that must be resolved before this step can run.
Sourcepub fn requires_permission(
self,
perm: GhPermission,
value: GhPermissionValue,
) -> Self
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
Sourcepub fn finish(self, ctx: &mut NodeCtx<'_>) -> ReadVar<SideEffect>
pub fn finish(self, ctx: &mut NodeCtx<'_>) -> ReadVar<SideEffect>
Finish building the step, emitting it to the backend and returning a side-effect.