Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/fbe/github_graph.rb
Original file line number Diff line number Diff line change
Expand Up @@ -490,11 +490,12 @@ def total_releases_published(owner, name, since)
total = 0
cursor = nil
loop do
after = "after: \"#{cursor}\", " unless cursor.nil?
result = query(
<<~GRAPHQL
{
repository(owner: "#{owner}", name: "#{name}") {
releases(first: 25, after: "#{cursor}", orderBy: { field: CREATED_AT, direction: DESC }) {
releases(#{after}first: 25, orderBy: { field: CREATED_AT, direction: DESC }) {
nodes {
isDraft
publishedAt
Expand Down
13 changes: 13 additions & 0 deletions test/fbe/test_github_graph.rb
Original file line number Diff line number Diff line change
Expand Up @@ -315,4 +315,17 @@ def test_pull_request_reviews_omits_after_when_cursor_is_nil
graph.pull_request_reviews('foo', 'bar', pulls: [[2, nil]])
refute_includes(captured, 'after: ""')
end

def test_total_releases_published_omits_after_when_cursor_is_nil
WebMock.disable_net_connect!
graph = Fbe::Graph.new(token: 'fake')
captured = nil
releases = { 'nodes' => [], 'pageInfo' => { 'hasNextPage' => false, 'endCursor' => nil } }
graph.define_singleton_method(:query) do |qry|
captured = qry
{ 'repository' => { 'releases' => releases } }
end
graph.total_releases_published('foo', 'bar', Time.parse('2025-12-16T15:00:00Z'))
refute_includes(captured, 'after: ""')
end
end
Loading