fbe 0.45.0 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/fbe/github_graph.rb +49 -0
- data/lib/fbe.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 519554aa1f1b5867cb510a32c18b02abbfd23e53d2a9c4ef1a8d69c062b29251
|
|
4
|
+
data.tar.gz: 54ab82081ac47eeba118a5a781766d235567fa4223953a449ae4178a33625a6e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 49b3280b79b52dda1cde1d082475fc1a5bfc2cdbf4158cb86622582333e0a01d9d837d9649f5bfe9b456fc22c8c97ac904930e78535a500941bc413695a14044
|
|
7
|
+
data.tar.gz: 027f14cfde422c350996b4a7ab036c10a24fb85abd37230519d1b26871d38526a3ad8772a09df99b7bbca4db88625b523c414c491ebe5cb05a71037646143b56
|
data/lib/fbe/github_graph.rb
CHANGED
|
@@ -389,6 +389,48 @@ class Fbe::Graph
|
|
|
389
389
|
end
|
|
390
390
|
end
|
|
391
391
|
|
|
392
|
+
# Get total commits pushed to default branch
|
|
393
|
+
#
|
|
394
|
+
# @param [String] owner The repository owner (username or organization)
|
|
395
|
+
# @param [String] name The repository name
|
|
396
|
+
# @param [Time] since The datetime from
|
|
397
|
+
# @return [Hash] A hash with total commits and hocs
|
|
398
|
+
def total_commits_pushed(owner, name, since)
|
|
399
|
+
# @todo #1223:60min Missing pagination could cause performance issues or API failures. You need add
|
|
400
|
+
# pagination for commit history, for more info see
|
|
401
|
+
# https://github.com/zerocracy/fbe/pull/366#discussion_r2610751758
|
|
402
|
+
result = query(
|
|
403
|
+
<<~GRAPHQL
|
|
404
|
+
{
|
|
405
|
+
repository(owner: "#{owner}", name: "#{name}") {
|
|
406
|
+
defaultBranchRef {
|
|
407
|
+
target {
|
|
408
|
+
... on Commit {
|
|
409
|
+
history(since: "#{since.utc.iso8601}") {
|
|
410
|
+
totalCount
|
|
411
|
+
nodes {
|
|
412
|
+
oid
|
|
413
|
+
parents {
|
|
414
|
+
totalCount
|
|
415
|
+
}
|
|
416
|
+
additions
|
|
417
|
+
deletions
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
GRAPHQL
|
|
426
|
+
).to_h
|
|
427
|
+
commits = result.dig('repository', 'defaultBranchRef', 'target', 'history', 'nodes')
|
|
428
|
+
{
|
|
429
|
+
'commits' => result.dig('repository', 'defaultBranchRef', 'target', 'history', 'totalCount') || 0,
|
|
430
|
+
'hoc' => commits.nil? ? 0 : commits.sum { (_1['additions'] || 0) + (_1['deletions'] || 0) }
|
|
431
|
+
}
|
|
432
|
+
end
|
|
433
|
+
|
|
392
434
|
private
|
|
393
435
|
|
|
394
436
|
# Creates or returns a cached GraphQL client instance.
|
|
@@ -617,6 +659,13 @@ class Fbe::Graph
|
|
|
617
659
|
]
|
|
618
660
|
end
|
|
619
661
|
|
|
662
|
+
def total_commits_pushed(_owner, _name, _since)
|
|
663
|
+
{
|
|
664
|
+
'commits' => 29,
|
|
665
|
+
'hoc' => 1857
|
|
666
|
+
}
|
|
667
|
+
end
|
|
668
|
+
|
|
620
669
|
private
|
|
621
670
|
|
|
622
671
|
# Generates mock conversation thread data.
|
data/lib/fbe.rb
CHANGED