github_repo_statistics 2.2.11 → 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: 45284d03e5ffb00cb2ed37dc99c775c4cd5270aa82ab8b56e71280d095fdc6f0
4
- data.tar.gz: 14b0536562640711fc5219302932b55eaeae6d5a0ce08caf6fe01f50d3ad86b3
3
+ metadata.gz: 8800c4a2d628982565f80eb824eee40394cc37ca4cd3a9bf48c1a90ebe121c08
4
+ data.tar.gz: 161ca141a826f73be14b60124956d7324a464cf32a6958fa1724513299462d36
5
5
  SHA512:
6
- metadata.gz: dd4cc361ad9a4e47ace0970e27fc201cfd73e14f2fe54d1be2378331c8e9de80b757c657bab8099633cf0c43cf57f972850e645e68649f19379cd0f6b613ef22
7
- data.tar.gz: 93ac3757ec59d6ce9b433424bbf498635a9c26fa6b89324dcfb1b7164d4395588ed5cc31073b5692ae1014c8e474b374e160699d44904c6366b4181ef7119178
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.10)
4
+ github_repo_statistics (2.2.11)
5
5
  date
6
6
  faraday-retry
7
7
  google-cloud-bigquery
@@ -122,10 +122,11 @@ class ForceMergeReport
122
122
  target.unit_tests_count = #{unit_tests_check},
123
123
  target.size_check_count = #{size_check},
124
124
  target.sonarqube_count = #{sonarqube_check},
125
- target.total_prs = #{total_prs}
125
+ target.total_prs = #{total_prs},
126
+ target.platform = '#{@repo}'
126
127
  WHEN NOT MATCHED THEN
127
- INSERT (calendar_week, force_merges_count, ui_tests_count, unit_tests_count, size_check_count, sonarqube_count, total_prs)
128
- VALUES ('#{week}', #{failed_count}, #{ui_tests_check}, #{unit_tests_check}, #{size_check}, #{sonarqube_check}, #{total_prs});
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}');
129
130
  SQL
130
131
 
131
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.11'
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.11
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-03 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