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