github_repo_statistics 2.2.6 → 2.2.8

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: 959ee199b0ea42238f2694323f48877276f03828cb14ea10961f24ce7072c20f
4
- data.tar.gz: 75096534af0a22946e376f6b9f9ac4763e58480e6f04e49c50c3bd2adb484ad0
3
+ metadata.gz: 9ef7c493b69d48cbb4e65fa99b8daeac622a6a8bcdf2c686a73102ddbdbdbab2
4
+ data.tar.gz: 62bf5ff22b128242b3cf5a2ffeb9bae13bd6b3b16b6026dbabb51e1e7ed9b609
5
5
  SHA512:
6
- metadata.gz: f83c75ebd84a3cfbe794439e6574a55210417c50b576c5b8601c84854a3a597bf31f1077365bda35f9c103a4186a6ca61642cd4d3d43ddbacbe79e02e22ad899
7
- data.tar.gz: 895557370c5ad8559bbe069e3d67099c2e982a555a012bafce3992f7a06ec138d56080f55adb97aaace459e6f6c34e3aa41a3ee659f59d1d937a73b6733b7e6e
6
+ metadata.gz: 43bb62af4096988880381c52661324e774717a0db51698f063d610bbab9f2988d94ffc4f1ae32e716eeede181923dc06cd0f8afde5a112e41a63c4cbc72850e5
7
+ data.tar.gz: 4cf1461f0388f4c57326999f9864644db68faa2d7a76b88ce2b4e35f00ee9991d4114ad67270aba6210e4b3b3c5a0fd2adf1977c201730642bd5d84f170bb051
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- github_repo_statistics (2.1.0)
4
+ github_repo_statistics (2.2.7)
5
5
  date
6
6
  faraday-retry
7
7
  google-cloud-bigquery
@@ -20,7 +20,11 @@ class ForceMergeReport
20
20
  pull_requests = client.list_issues(@repo, state: 'closed', since: DateTime.now - @duration_in_days)
21
21
 
22
22
  # Sort PRs into monthly chunks
23
- weekly_pull_requests = pull_requests.group_by { |pr| pr.closed_at.strftime('%Y-%U') }
23
+ weekly_pull_requests = pull_requests.group_by { |pr| pr.closed_at.strftime('%Y-%W') }
24
+
25
+ if weekly_pull_requests[Time.now.strftime('%Y-%W')].nil?
26
+ weekly_pull_requests[Time.now.strftime('%Y-%W')] = []
27
+ end
24
28
 
25
29
  # Initialize a hash to store monthly summaries
26
30
  weekly_summaries = Hash.new { |hash, key| hash[key] = { total: 0, failed: 0, workflows: Hash.new(0) } }
@@ -49,6 +53,10 @@ class ForceMergeReport
49
53
  # Filter checks without meeting the required status checks
50
54
  failed_checks = all_checks.reject { |check| check.conclusion == 'success' || check.state == 'success' }
51
55
 
56
+ failed_checks.select! do |check|
57
+ ['Mergeable: Size check', 'SonarQube Code Analysis', 'UI Tests', 'Unit Tests'].include?(check.name)
58
+ end
59
+
52
60
  # Update monthly summary
53
61
  weekly_summaries[month][:total] += 1
54
62
  weekly_summaries[month][:failed] += 1 unless failed_checks.empty?
@@ -82,6 +90,7 @@ class ForceMergeReport
82
90
  summary[:workflows].each do |workflow, count|
83
91
  puts " - #{workflow}: #{count}"
84
92
  end
93
+
85
94
  if ENV['BQ_CREDENTIALS']
86
95
  require "google/cloud/bigquery"
87
96
  require "json"
@@ -93,15 +102,25 @@ class ForceMergeReport
93
102
  dataset = bigquery.dataset "github_data"
94
103
 
95
104
  failed_count = summary[:failed]
105
+ size_check = summary[:workflows]["Mergeable: Size check"]
106
+ sonarqube_check = summary[:workflows]['SonarQube Code Analysis']
107
+ ui_tests_check = summary[:workflows]['UI Tests']
108
+ unit_tests_check = summary[:workflows]['Unit Tests']
96
109
 
97
110
  query = <<~SQL
98
111
  MERGE INTO force_merges AS target
99
112
  USING (SELECT '#{week}' AS calendar_week) AS source
100
113
  ON target.calendar_week = source.calendar_week
101
114
  WHEN MATCHED THEN
102
- UPDATE SET target.force_merges_count = #{failed_count}
115
+ UPDATE SET
116
+ target.force_merges_count = #{failed_count},
117
+ target.ui_tests_count = #{ui_tests_check},
118
+ target.unit_tests_count = #{unit_tests_check},
119
+ target.size_check_count = #{size_check},
120
+ target.sonarqube_count = #{sonarqube_check}
103
121
  WHEN NOT MATCHED THEN
104
- INSERT (calendar_week, force_merges_count) VALUES ('#{week}', #{failed_count});
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});
105
124
  SQL
106
125
 
107
126
  dataset.query(query)
@@ -28,7 +28,7 @@ class ReviewReport
28
28
  pull_requests = client.list_issues(@repo, state: 'closed', since: DateTime.now - @duration_in_days)
29
29
 
30
30
  # Group pull requests by week
31
- pull_requests_by_week = pull_requests.group_by { |pr| pr[:closed_at].strftime('%Y-%U') }
31
+ pull_requests_by_week = pull_requests.group_by { |pr| pr[:closed_at].strftime('%Y-%W') }
32
32
 
33
33
  weeks = @duration_in_days / 7
34
34
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class GithubRepoStatistics
4
- VERSION = '2.2.6'
4
+ VERSION = '2.2.8'
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.6
4
+ version: 2.2.8
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-02-28 00:00:00.000000000 Z
11
+ date: 2024-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: date