1mod client;
8mod definition;
9mod model;
10mod request;
11mod workflow;
12
13pub use definition::{match_job_dependencies, parse_workflow_definition};
14pub use model::*;
15
16pub trait ActionsApi {
18 fn actions_workflows(
19 &self,
20 login: &str,
21 repo: &str,
22 ) -> Result<Page<Workflow>, subspace_core::http::Error>;
23 fn actions_runs(
24 &self,
25 login: &str,
26 repo: &str,
27 filters: &RunFilters,
28 ) -> Result<Page<WorkflowRun>, subspace_core::http::Error>;
29 fn actions_run(
30 &self,
31 login: &str,
32 repo: &str,
33 run_id: u64,
34 ) -> Result<WorkflowRun, subspace_core::http::Error>;
35 fn actions_jobs(
36 &self,
37 login: &str,
38 repo: &str,
39 run_id: u64,
40 ) -> Result<Page<Job>, subspace_core::http::Error>;
41 fn actions_attempt_jobs(
52 &self,
53 login: &str,
54 repo: &str,
55 run_id: u64,
56 attempt: u64,
57 ) -> Result<Page<Job>, subspace_core::http::Error> {
58 match attempt {
59 0 => self.actions_jobs(login, repo, run_id),
60 _ => Err(subspace_core::http::Error::Status {
61 status: ureq::http::StatusCode::NOT_IMPLEMENTED.as_u16(),
62 message: "This GitHub client cannot read the jobs of one run attempt.".into(),
63 }),
64 }
65 }
66 fn actions_job_log(
67 &self,
68 login: &str,
69 repo: &str,
70 job_id: u64,
71 ) -> Result<JobLog, subspace_core::http::Error>;
72 fn actions_workflow_definition(
73 &self,
74 login: &str,
75 repo: &str,
76 sha: &str,
77 path: &str,
78 ) -> Result<Definition<WorkflowDefinition>, subspace_core::http::Error>;
79 fn actions_pending_deployments(
80 &self,
81 login: &str,
82 repo: &str,
83 run_id: u64,
84 ) -> Result<Vec<PendingDeployment>, subspace_core::http::Error>;
85 fn actions_environments(
86 &self,
87 login: &str,
88 repo: &str,
89 ) -> Result<Page<Environment>, subspace_core::http::Error>;
90 fn actions_deployments(
91 &self,
92 login: &str,
93 repo: &str,
94 environment: Option<&str>,
95 ) -> Result<Page<Deployment>, subspace_core::http::Error>;
96 fn actions_latest_deployment(
97 &self,
98 login: &str,
99 repo: &str,
100 environment: &str,
101 ) -> Result<Option<Deployment>, subspace_core::http::Error> {
102 self.actions_deployments(login, repo, Some(environment))
103 .map(|page| page.items.into_iter().next())
104 }
105 fn actions_releases(
106 &self,
107 login: &str,
108 repo: &str,
109 ) -> Result<Page<Release>, subspace_core::http::Error>;
110 fn actions_tags(
111 &self,
112 login: &str,
113 repo: &str,
114 ) -> Result<Page<TagRef>, subspace_core::http::Error>;
115 fn dispatch_workflow(
116 &self,
117 login: &str,
118 request: &DispatchRequest<'_>,
119 ) -> Result<(), subspace_core::http::Error>;
120 fn rerun_workflow(
121 &self,
122 login: &str,
123 repo: &str,
124 run_id: u64,
125 ) -> Result<(), subspace_core::http::Error>;
126 fn rerun_failed_jobs(
127 &self,
128 login: &str,
129 repo: &str,
130 run_id: u64,
131 ) -> Result<(), subspace_core::http::Error>;
132 fn cancel_workflow(
133 &self,
134 login: &str,
135 repo: &str,
136 run_id: u64,
137 ) -> Result<(), subspace_core::http::Error>;
138 fn review_pending_deployments(
139 &self,
140 login: &str,
141 request: &ReviewPendingRequest<'_>,
142 ) -> Result<(), subspace_core::http::Error>;
143}
144
145#[cfg(test)]
146mod tests;