Skip to content

Commit 3a9fadc

Browse files
Merge pull request #1359 from travis-ci/release_250303
Release 2025.03.03
2 parents 2704275 + b76de27 commit 3a9fadc

File tree

6 files changed

+31
-15
lines changed

6 files changed

+31
-15
lines changed

lib/travis/api/v3/renderer/repository.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
module Travis::API::V3
22
class Renderer::Repository < ModelRenderer
33
representation(:minimal, :id, :name, :slug)
4-
representation(:standard, :id, :name, :slug, :description, :github_id, :vcs_id, :vcs_type, :github_language, :active, :private, :owner, :owner_name, :vcs_name, :default_branch, :starred, :managed_by_installation, :active_on_org, :migration_status, :history_migration_status, :shared, :config_validation, :server_type, :scan_failed_at)
5-
representation(:experimental, :id, :name, :slug, :description, :vcs_id, :vcs_type, :github_id, :github_language, :active, :private, :owner, :default_branch, :starred, :current_build, :last_started_build, :next_build_number, :server_type, :scan_failed_at)
4+
representation(:standard, :id, :name, :slug, :description, :github_id, :vcs_id, :vcs_type, :github_language, :active, :private, :owner, :owner_name, :vcs_name, :default_branch, :starred, :managed_by_installation, :active_on_org, :migration_status, :history_migration_status, :shared, :config_validation, :server_type, :scan_failed_at, :build_count)
5+
representation(:experimental, :id, :name, :slug, :description, :vcs_id, :vcs_type, :github_id, :github_language, :active, :private, :owner, :default_branch, :starred, :current_build, :last_started_build, :next_build_number, :server_type, :scan_failed_at, :build_count)
66
representation(:internal, :id, :name, :slug, :github_id, :vcs_id, :vcs_type, :active, :private, :owner, :default_branch, :private_key, :token, :user_settings, :server_type, :scan_failed_at)
77
representation(:list, :id, :name, :slug, :active, :private, :owner, :vcs_id, :vcs_type, :server_type)
8-
representation(:minimal_with_build, :id, :name, :slug, :active, :private, :owner, :vcs_id, :vcs_type, :server_type, :managed_by_installation, :last_started_build, :current_build)
9-
representation(:additional, :allow_migration)
8+
representation(:minimal_with_build, :id, :name, :slug, :active, :private, :owner, :vcs_id, :vcs_type, :server_type, :managed_by_installation, :last_started_build, :current_build, :build_count)
9+
representation(:additional, :allow_migration, :build_count)
1010

1111
hidden_representations(:experimental, :internal)
1212

@@ -37,6 +37,10 @@ def default_branch
3737
}
3838
end
3939

40+
def build_count
41+
model.builds.where.not(event_type: :pull_request).length
42+
end
43+
4044
def current_build
4145
build = model.current_build
4246
build if access_control.visible? build

spec/v3/services/owner/find_spec.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@
207207
"active_on_org" => nil,
208208
"migration_status" => nil,
209209
"history_migration_status" => nil,
210-
"config_validation" => false
210+
"config_validation" => false,
211+
"build_count" => 0
211212
}]
212213
}}
213214
end
@@ -313,7 +314,8 @@
313314
"active_on_org" => nil,
314315
"migration_status" => nil,
315316
"history_migration_status" => nil,
316-
"config_validation" => false
317+
"config_validation" => false,
318+
"build_count" => 0
317319
}]
318320
}}
319321
end

spec/v3/services/repositories/for_current_user_spec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,11 @@
101101
"name" => "master"},
102102
"starred" => false,
103103
"managed_by_installation"=>false,
104-
"active_on_org"=>nil,
105-
"migration_status" => nil,
104+
"active_on_org" =>nil,
105+
"migration_status" => nil,
106106
"history_migration_status" => nil,
107-
"config_validation" => false
107+
"config_validation" => false,
108+
"build_count" => 3
108109
}]
109110
}}
110111
end

spec/v3/services/repositories/for_owner_spec.rb

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@
134134
"active_on_org" => nil,
135135
"migration_status" => nil,
136136
"history_migration_status" => nil,
137-
"config_validation" => false
137+
"config_validation" => false,
138+
"build_count" => 3
138139
}]}}
139140
end
140141

@@ -210,6 +211,7 @@
210211
"migration_status" => nil,
211212
"history_migration_status" => nil,
212213
"config_validation" => false,
214+
"build_count" => 3,
213215
"last_started_build"=>{
214216
"@type" =>"build",
215217
"@href" =>"/v3/build/#{build.id}",
@@ -348,6 +350,7 @@
348350
"migration_status" => nil,
349351
"history_migration_status" => nil,
350352
"config_validation" => false,
353+
"build_count" => 3,
351354
"current_build" => {
352355
"@type" => "build",
353356
"@href" => "/v3/build/#{build.id}",
@@ -528,7 +531,8 @@
528531
"active_on_org" => nil,
529532
"migration_status" => nil,
530533
"history_migration_status" => nil,
531-
"config_validation" => false}, {
534+
"config_validation" => false,
535+
"build_count" => 3}, {
532536
"@type" => "repository",
533537
"@href" => "/v3/repo/#{repo2.id}",
534538
"@representation" => "standard",
@@ -590,7 +594,9 @@
590594
"active_on_org" =>nil,
591595
"migration_status" => nil,
592596
"history_migration_status" => nil,
593-
"config_validation" => false}]}
597+
"config_validation" => false,
598+
"build_count" => 0
599+
}]}
594600
end
595601

596602
describe "shared repository for collaborator, authenticated as user with access" do
@@ -684,7 +690,8 @@
684690
"active_on_org" => nil,
685691
"migration_status" => nil,
686692
"history_migration_status" => nil,
687-
"config_validation" => false
693+
"config_validation" => false,
694+
"build_count" => 1
688695
}]}}
689696
end
690697

spec/v3/services/repository/find_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@
168168
"managed_by_installation" => false,
169169
"migration_status" => nil,
170170
"history_migration_status" => nil,
171-
"config_validation" => false
171+
"config_validation" => false,
172+
"build_count" => 3
172173
})}
173174
end
174175

spec/v3/services/v2_subscription/executions_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@
162162
"history_migration_status"=>nil,
163163
"scan_failed_at"=>nil,
164164
"shared"=>false,
165-
"config_validation"=>false
165+
"config_validation"=>false,
166+
"build_count"=> 3
166167
}
167168
}
168169
]

0 commit comments

Comments
 (0)