@@ -152,19 +152,18 @@ extension Gitlab.Builder {
152152 }
153153
154154 // periphery:ignore
155- struct Pipeline : Decodable {
155+ struct Job : Decodable {
156156 var id : Int
157- var status : Status
158157 }
159158
160- // https://docs.gitlab.com/ee/api/pipelines .html
161- static func fetchPipelines ( status: Status ,
162- page: Int ,
163- pageSize: Int = 20 ) async throws -> [ Pipeline ] {
159+ // https://docs.gitlab.com/ee/api/jobs .html
160+ static func fetchJobs ( status: Status ,
161+ page: Int ,
162+ pageSize: Int = 20 ) async throws -> [ Job ] {
164163 @Dependency ( \. environment) var environment
165164 @Dependency ( \. httpClient) var httpClient
166165 guard let apiToken = environment. gitlabApiToken ( ) else { throw Gitlab . Error. missingToken }
167- let url = " \( projectURL) /pipelines?status = \( status) &page= \( page) &per_page= \( pageSize) "
166+ let url = " \( projectURL) /jobs?scope = \( status) &page= \( page) &per_page= \( pageSize) "
168167
169168 let response = try await httpClient. get ( url: url, headers: . bearer( apiToken) )
170169
@@ -173,14 +172,14 @@ extension Gitlab.Builder {
173172 }
174173 guard let body = response. body else { throw Gitlab . Error. noBody }
175174
176- return try Gitlab . decoder. decode ( [ Pipeline ] . self, from: body)
175+ return try Gitlab . decoder. decode ( [ Job ] . self, from: body)
177176 }
178177
179178 static func getStatusCount( status: Status ,
180179 page: Int = 1 ,
181180 pageSize: Int = 20 ,
182181 maxPageCount: Int = 5 ) async throws -> Int {
183- let count = try await fetchPipelines ( status: status, page: page, pageSize: pageSize) . count
182+ let count = try await fetchJobs ( status: status, page: page, pageSize: pageSize) . count
184183 if count == pageSize && page < maxPageCount {
185184 let statusCount = try await getStatusCount ( status: status,
186185 page: page + 1 ,
0 commit comments