github_repo_statistics 2.2.10 → 2.2.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: afcbf9010b40c88fced56016369ff61b71a4e6cfdabd924640f4ce1f5351236c
4
- data.tar.gz: bdbfb01abf97a95bb2ec05fbb29d7815793469d0c84387d92d8ba2eeb32c4be8
3
+ metadata.gz: 8800c4a2d628982565f80eb824eee40394cc37ca4cd3a9bf48c1a90ebe121c08
4
+ data.tar.gz: 161ca141a826f73be14b60124956d7324a464cf32a6958fa1724513299462d36
5
5
  SHA512:
6
- metadata.gz: '039e58d9cae34858f93ca74675e6c8c732db7a5eee25a743e1949eea1076e70626b03a30101e410d8c9ca081cd4e818a7bb4ef13c9413d40bab5ec21dc12110e'
7
- data.tar.gz: 2d831c705ac45242af5c87605aad3b88879b5042706cefe4b9bb71c6e343027e1e812e9492c6aba99273e9b6e66a1cfaef98f2dbfb6053aa824bf976237dddd0
6
+ metadata.gz: 6a3ed11bc49f145fe479a900d6ad527f78ac8cec1234eab7dfb934784674fbc285dbce2b12876f6092827f1a58b1b533712238cabccd0dd3d25ef6bc3a718aba
7
+ data.tar.gz: 47099629c0304465b6c0bf5ed587b7b2bab70eb23e7e0328b65179552eeaaf8acb80d4a105ad03535ea3fab5a8e92ea4a95c5e3f5dc8bd86811d187193c8d1f6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- github_repo_statistics (2.2.8)
4
+ github_repo_statistics (2.2.11)
5
5
  date
6
6
  faraday-retry
7
7
  google-cloud-bigquery
@@ -31,6 +31,9 @@ class ForceMergeReport
31
31
 
32
32
  weeks = @duration_in_days / 7
33
33
 
34
+ require 'pry'
35
+ binding.pry
36
+
34
37
  (weekly_pull_requests.keys.sort[-weeks..] || []).each do |month|
35
38
  pull_requests_for_month = weekly_pull_requests[month]
36
39
  # Iterate through pull requests for the current month
@@ -106,6 +109,7 @@ class ForceMergeReport
106
109
  sonarqube_check = summary[:workflows]['SonarQube Code Analysis']
107
110
  ui_tests_check = summary[:workflows]['UI Tests']
108
111
  unit_tests_check = summary[:workflows]['Unit Tests']
112
+ total_prs = summary[:total]
109
113
 
110
114
  query = <<~SQL
111
115
  MERGE INTO force_merges AS target
@@ -117,10 +121,12 @@ class ForceMergeReport
117
121
  target.ui_tests_count = #{ui_tests_check},
118
122
  target.unit_tests_count = #{unit_tests_check},
119
123
  target.size_check_count = #{size_check},
120
- target.sonarqube_count = #{sonarqube_check}
124
+ target.sonarqube_count = #{sonarqube_check},
125
+ target.total_prs = #{total_prs},
126
+ target.platform = '#{@repo}'
121
127
  WHEN NOT MATCHED THEN
122
- INSERT (calendar_week, force_merges_count, ui_tests_count, unit_tests_count, size_check_count, sonarqube_count)
123
- VALUES ('#{week}', #{failed_count}, #{ui_tests_check}, #{unit_tests_check}, #{size_check}, #{sonarqube_check});
128
+ INSERT (calendar_week, force_merges_count, ui_tests_count, unit_tests_count, size_check_count, sonarqube_count, total_prs, platform)
129
+ VALUES ('#{week}', #{failed_count}, #{ui_tests_check}, #{unit_tests_check}, #{size_check}, #{sonarqube_check}, #{total_prs}, '#{@repo}');
124
130
  SQL
125
131
 
126
132
  dataset.query(query)
@@ -86,8 +86,38 @@ class ReviewReport
86
86
  puts " Total reviews: #{total_reviews}"
87
87
  puts " Reviews with comments: #{reviews_with_comments}"
88
88
  puts " Change requested reviews: #{change_requested_reviews}"
89
+
90
+ if ENV['BQ_CREDENTIALS']
91
+ require "google/cloud/bigquery"
92
+ require "json"
93
+ creds = JSON.parse(ENV['BQ_CREDENTIALS'])
94
+ bigquery = Google::Cloud::Bigquery.new(
95
+ project_id: "hellofresh-android",
96
+ credentials: creds
97
+ )
98
+ dataset = bigquery.dataset "github_data"
99
+
100
+ query = <<~SQL
101
+ MERGE INTO pr_reviews AS target
102
+ USING (SELECT '#{week}' AS calendar_week) AS source
103
+ ON target.calendar_week = source.calendar_week
104
+ WHEN MATCHED THEN
105
+ UPDATE SET
106
+ target.change_requested_reviews = #{change_requested_reviews},
107
+ target.reviews_with_comments = #{reviews_with_comments},
108
+ target.total_reviews = #{total_reviews},
109
+ target.average_review_time_hours = #{average_time_hours.round(2)},
110
+ target.total_prs = #{total_count},
111
+ target.platform = '#{@repo}'
112
+ WHEN NOT MATCHED THEN
113
+ INSERT (calendar_week, total_prs, average_review_time_hours, total_reviews, reviews_with_comments, change_requested_reviews, platform)
114
+ VALUES ('#{week}', #{total_count}, #{average_time_hours.round(2)}, #{total_reviews}, #{reviews_with_comments}, #{change_requested_reviews}, '#{@repo}');
115
+ SQL
116
+
117
+ dataset.query(query)
118
+ end
89
119
  else
90
- puts "Month #{week}: No pull requests with reviews."
120
+ puts "#{week}: No pull requests with reviews."
91
121
  end
92
122
  end
93
123
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class GithubRepoStatistics
4
- VERSION = '2.2.10'
4
+ VERSION = '2.2.12'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github_repo_statistics
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.10
4
+ version: 2.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Serghei Moret
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-01 00:00:00.000000000 Z
11
+ date: 2024-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: date