pub struct WorkflowsClient { /* private fields */ }Expand description
Domain client for GitHub Actions workflow and run operations.
Obtained via InstallationClient::workflows(). Cheap to clone (Arc-backed).
See docs/specs/interfaces/additional-operations.md
Implementations§
Source§impl WorkflowsClient
impl WorkflowsClient
Sourcepub async fn list(
&self,
owner: &str,
repo: &str,
) -> Result<Vec<Workflow>, ApiError>
pub async fn list( &self, owner: &str, repo: &str, ) -> Result<Vec<Workflow>, ApiError>
List workflows in a repository.
Retrieves all GitHub Actions workflows for a repository.
§Arguments
owner- Repository ownerrepo- Repository name
§Returns
Returns vector of workflows.
§Errors
ApiError::NotFound- Repository does not existApiError::AuthorizationFailed- Insufficient permissions
§Example
let workflows = client.list("owner", "repo").await?;
for workflow in workflows {
println!("Workflow: {} ({})", workflow.name, workflow.state);
}Sourcepub async fn get(
&self,
owner: &str,
repo: &str,
workflow_id: u64,
) -> Result<Workflow, ApiError>
pub async fn get( &self, owner: &str, repo: &str, workflow_id: u64, ) -> Result<Workflow, ApiError>
Get a specific workflow by ID.
Retrieves details about a single workflow.
§Arguments
owner- Repository ownerrepo- Repository nameworkflow_id- Workflow ID
§Returns
Returns the Workflow with the specified ID.
§Errors
ApiError::NotFound- Workflow does not existApiError::AuthorizationFailed- Insufficient permissions
§Example
let workflow = client.get("owner", "repo", 123456).await?;
println!("Workflow: {} at {}", workflow.name, workflow.path);Sourcepub async fn trigger(
&self,
owner: &str,
repo: &str,
workflow_id: u64,
request: TriggerWorkflowRequest,
) -> Result<(), ApiError>
pub async fn trigger( &self, owner: &str, repo: &str, workflow_id: u64, request: TriggerWorkflowRequest, ) -> Result<(), ApiError>
Trigger a workflow run.
Manually triggers a workflow run using workflow_dispatch event.
§Arguments
owner- Repository ownerrepo- Repository nameworkflow_id- Workflow IDrequest- Trigger parameters (ref and optional inputs)
§Returns
Returns Ok(()) on successful trigger.
§Errors
ApiError::NotFound- Workflow does not existApiError::InvalidRequest- Workflow not configured for manual dispatchApiError::AuthorizationFailed- Insufficient permissions
§Example
let request = TriggerWorkflowRequest {
git_ref: "main".to_string(),
inputs: None,
};
client.trigger("owner", "repo", 123456, request).await?;
println!("Workflow triggered");Sourcepub async fn list_runs(
&self,
owner: &str,
repo: &str,
workflow_id: u64,
) -> Result<Vec<WorkflowRun>, ApiError>
pub async fn list_runs( &self, owner: &str, repo: &str, workflow_id: u64, ) -> Result<Vec<WorkflowRun>, ApiError>
List workflow runs for a workflow.
Retrieves workflow runs for a specific workflow.
§Arguments
owner- Repository ownerrepo- Repository nameworkflow_id- Workflow ID
§Returns
Returns vector of workflow runs.
§Errors
ApiError::NotFound- Workflow does not existApiError::AuthorizationFailed- Insufficient permissions
§Example
let runs = client.list_runs("owner", "repo", 123456).await?;
for run in runs {
println!("Run #{}: {} ({})", run.run_number, run.status, run.conclusion.unwrap_or_default());
}Sourcepub async fn get_run(
&self,
owner: &str,
repo: &str,
run_id: u64,
) -> Result<WorkflowRun, ApiError>
pub async fn get_run( &self, owner: &str, repo: &str, run_id: u64, ) -> Result<WorkflowRun, ApiError>
Get a specific workflow run by ID.
Retrieves details about a single workflow run.
§Arguments
owner- Repository ownerrepo- Repository namerun_id- Workflow run ID
§Returns
Returns the WorkflowRun with the specified ID.
§Errors
ApiError::NotFound- Workflow run does not existApiError::AuthorizationFailed- Insufficient permissions
§Example
let run = client.get_run("owner", "repo", 987654).await?;
println!("Run #{}: {}", run.run_number, run.status);Sourcepub async fn cancel_run(
&self,
owner: &str,
repo: &str,
run_id: u64,
) -> Result<(), ApiError>
pub async fn cancel_run( &self, owner: &str, repo: &str, run_id: u64, ) -> Result<(), ApiError>
Cancel a workflow run.
Cancels a workflow run that is in progress.
§Arguments
owner- Repository ownerrepo- Repository namerun_id- Workflow run ID
§Returns
Returns Ok(()) on successful cancellation.
§Errors
ApiError::NotFound- Workflow run does not existApiError::InvalidRequest- Workflow run cannot be cancelledApiError::AuthorizationFailed- Insufficient permissions
§Example
client.cancel_run("owner", "repo", 987654).await?;
println!("Workflow run cancelled");Sourcepub async fn rerun_run(
&self,
owner: &str,
repo: &str,
run_id: u64,
) -> Result<(), ApiError>
pub async fn rerun_run( &self, owner: &str, repo: &str, run_id: u64, ) -> Result<(), ApiError>
Re-run a workflow run.
Re-runs a completed workflow run.
§Arguments
owner- Repository ownerrepo- Repository namerun_id- Workflow run ID
§Returns
Returns Ok(()) on successful re-run trigger.
§Errors
ApiError::NotFound- Workflow run does not existApiError::InvalidRequest- Workflow run cannot be re-runApiError::AuthorizationFailed- Insufficient permissions
§Example
client.rerun_run("owner", "repo", 987654).await?;
println!("Workflow run re-triggered");Trait Implementations§
Source§impl Clone for WorkflowsClient
impl Clone for WorkflowsClient
Source§fn clone(&self) -> WorkflowsClient
fn clone(&self) -> WorkflowsClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more