pub struct Workflow {
pub name: Option<String>,
pub env: Option<Env>,
pub run_name: Option<String>,
pub on: Option<Event>,
pub permissions: Option<Permissions>,
pub jobs: Option<Jobs>,
pub concurrency: Option<Concurrency>,
pub defaults: Option<Defaults>,
pub secrets: Option<IndexMap<String, Secret>>,
pub timeout_minutes: Option<u32>,
}
Expand description
Represents the configuration for a GitHub workflow.
A workflow is a configurable automated process made up of one or more jobs. This struct defines the properties that can be set in a workflow YAML file for GitHub Actions, including the name, environment variables, permissions, jobs, concurrency settings, and more.
Fields§
§name: Option<String>
The name of the workflow. GitHub displays the names of your workflows under your repository’s “Actions” tab.
env: Option<Env>
Environment variables that can be used in the workflow.
run_name: Option<String>
The name for workflow runs generated from the workflow. GitHub displays the workflow run name in the list of workflow runs.
on: Option<Event>
The event that triggers the workflow. This can include events like
push
, pull_request
, etc.
permissions: Option<Permissions>
Permissions granted to the GITHUB_TOKEN
for the workflow.
jobs: Option<Jobs>
The jobs that are defined in the workflow.
concurrency: Option<Concurrency>
Concurrency settings for the workflow, allowing control over how jobs are executed.
defaults: Option<Defaults>
Default settings for jobs in the workflow.
secrets: Option<IndexMap<String, Secret>>
Secrets that can be used in the workflow, such as tokens or passwords.
timeout_minutes: Option<u32>
The maximum number of minutes a job can run before it is canceled.
Implementations§
Source§impl Workflow
impl Workflow
Sourcepub fn run_name(self, value: impl Into<String>) -> Workflow
pub fn run_name(self, value: impl Into<String>) -> Workflow
Sets the run_name
field of this struct.
Sourcepub fn permissions(self, value: impl Into<Permissions>) -> Workflow
pub fn permissions(self, value: impl Into<Permissions>) -> Workflow
Sets the permissions
field of this struct.
Sourcepub fn concurrency(self, value: impl Into<Concurrency>) -> Workflow
pub fn concurrency(self, value: impl Into<Concurrency>) -> Workflow
Sets the concurrency
field of this struct.
Sourcepub fn defaults(self, value: impl Into<Defaults>) -> Workflow
pub fn defaults(self, value: impl Into<Defaults>) -> Workflow
Sets the defaults
field of this struct.
Sourcepub fn secrets(self, value: impl Into<IndexMap<String, Secret>>) -> Workflow
pub fn secrets(self, value: impl Into<IndexMap<String, Secret>>) -> Workflow
Sets the secrets
field of this struct.
Sourcepub fn timeout_minutes(self, value: impl Into<u32>) -> Workflow
pub fn timeout_minutes(self, value: impl Into<u32>) -> Workflow
Sets the timeout_minutes
field of this struct.
Source§impl Workflow
impl Workflow
Sourcepub fn new<T>(name: T) -> Workflowwhere
T: ToString,
pub fn new<T>(name: T) -> Workflowwhere
T: ToString,
Creates a new Workflow
with the specified name.
Sourcepub fn to_string(&self) -> Result<String, Error>
pub fn to_string(&self) -> Result<String, Error>
Converts the Workflow
to a YAML string representation.
Sourcepub fn add_job_when<T, J>(self, cond: bool, id: T, job: J) -> Workflow
pub fn add_job_when<T, J>(self, cond: bool, id: T, job: J) -> Workflow
Adds a job to the workflow when a condition is met.
Sourcepub fn add_job<T, J>(self, id: T, job: J) -> Workflow
pub fn add_job<T, J>(self, id: T, job: J) -> Workflow
Adds a job to the workflow with the specified ID and job configuration.
Sourcepub fn add_event_when<T>(self, cond: bool, that: T) -> Workflow
pub fn add_event_when<T>(self, cond: bool, that: T) -> Workflow
Adds an event to the workflow when a condition is met.
Sourcepub fn add_env_when<T>(self, cond: bool, new_env: T) -> Workflow
pub fn add_env_when<T>(self, cond: bool, new_env: T) -> Workflow
Adds an environment variable to the workflow when a condition is met.