mod client;
mod definition;
mod model;
mod request;
mod workflow;
pub use definition::{match_job_dependencies, parse_workflow_definition};
pub use model::*;
pub trait ActionsApi {
fn actions_workflows(
&self,
login: &str,
repo: &str,
) -> Result<Page<Workflow>, subspace_core::http::Error>;
fn actions_runs(
&self,
login: &str,
repo: &str,
filters: &RunFilters,
) -> Result<Page<WorkflowRun>, subspace_core::http::Error>;
fn actions_run(
&self,
login: &str,
repo: &str,
run_id: u64,
) -> Result<WorkflowRun, subspace_core::http::Error>;
fn actions_jobs(
&self,
login: &str,
repo: &str,
run_id: u64,
) -> Result<Page<Job>, subspace_core::http::Error>;
fn actions_attempt_jobs(
&self,
login: &str,
repo: &str,
run_id: u64,
attempt: u64,
) -> Result<Page<Job>, subspace_core::http::Error> {
match attempt {
0 => self.actions_jobs(login, repo, run_id),
_ => Err(subspace_core::http::Error::Status {
status: ureq::http::StatusCode::NOT_IMPLEMENTED.as_u16(),
message: "This GitHub client cannot read the jobs of one run attempt.".into(),
}),
}
}
fn actions_job_log(
&self,
login: &str,
repo: &str,
job_id: u64,
) -> Result<JobLog, subspace_core::http::Error>;
fn actions_workflow_definition(
&self,
login: &str,
repo: &str,
sha: &str,
path: &str,
) -> Result<Definition<WorkflowDefinition>, subspace_core::http::Error>;
fn actions_pending_deployments(
&self,
login: &str,
repo: &str,
run_id: u64,
) -> Result<Vec<PendingDeployment>, subspace_core::http::Error>;
fn actions_environments(
&self,
login: &str,
repo: &str,
) -> Result<Page<Environment>, subspace_core::http::Error>;
fn actions_deployments(
&self,
login: &str,
repo: &str,
environment: Option<&str>,
) -> Result<Page<Deployment>, subspace_core::http::Error>;
fn actions_latest_deployment(
&self,
login: &str,
repo: &str,
environment: &str,
) -> Result<Option<Deployment>, subspace_core::http::Error> {
self.actions_deployments(login, repo, Some(environment))
.map(|page| page.items.into_iter().next())
}
fn actions_releases(
&self,
login: &str,
repo: &str,
) -> Result<Page<Release>, subspace_core::http::Error>;
fn actions_tags(
&self,
login: &str,
repo: &str,
) -> Result<Page<TagRef>, subspace_core::http::Error>;
fn dispatch_workflow(
&self,
login: &str,
request: &DispatchRequest<'_>,
) -> Result<(), subspace_core::http::Error>;
fn rerun_workflow(
&self,
login: &str,
repo: &str,
run_id: u64,
) -> Result<(), subspace_core::http::Error>;
fn rerun_failed_jobs(
&self,
login: &str,
repo: &str,
run_id: u64,
) -> Result<(), subspace_core::http::Error>;
fn cancel_workflow(
&self,
login: &str,
repo: &str,
run_id: u64,
) -> Result<(), subspace_core::http::Error>;
fn review_pending_deployments(
&self,
login: &str,
request: &ReviewPendingRequest<'_>,
) -> Result<(), subspace_core::http::Error>;
}
#[cfg(test)]
mod tests;