kettle-gha-pins 0.3.10 → 0.3.11

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: e39d2df910b12d4b40d0978f63481a73d87a5efcdf6ea58c4966b397d3319470
4
- data.tar.gz: 584ac1b59952635a279806c03aba51460a757e9edd2dbcafc5b7f158b8a302dd
3
+ metadata.gz: e6eef00386a5fa9f57acdf295331f68f11293cf9d90ef09adbb666aac6a97d0c
4
+ data.tar.gz: 6b433ddcef3d0599c12e8496aa5a80df31f6bcaee358634fb04c167a5c36ac24
5
5
  SHA512:
6
- metadata.gz: 43c208e30cd0c6501479f4cf52a48a3e4df4b9192ada22b05017681a4761ffe01ca4abdb0398cf8c523828a32814ef9fcd51cf57f2be46f7ff55b81c89e05237
7
- data.tar.gz: a47e19be556a73215a786b4e9fe23b50ac1890e5087ed0b5eea1a14e8e7f9dd1ce8da62d8e95a329949a6e339aacda9c1b8e12cabd0debe167e301ed12ca96f9
6
+ metadata.gz: 7c6fa524d51f68f4ffb392195d77cb44f782b9ec65e05940915b4ac595e036768a7ed647eca7d7aefbd9da30adebb462fc3e5860f138e783559054257d215982
7
+ data.tar.gz: d7097d6af75ffc23901d1e9fa6208f7704c9f5d12e54aab125438b61088418056ccab1730ad06643945f1fd82052f62d2c315e555769e33535eb7cdd07fbcb50
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -30,6 +30,19 @@ Please file a bug if you notice a violation of semantic versioning.
30
30
 
31
31
  ### Security
32
32
 
33
+ ## [0.3.11] - 2026-08-10
34
+
35
+ - TAG: [v0.3.11][0.3.11t]
36
+ - COVERAGE: 97.00% -- 1033/1065 lines in 8 files
37
+ - BRANCH COVERAGE: 85.60% -- 416/486 branches in 8 files
38
+ - 25.93% documented
39
+
40
+ ### Fixed
41
+
42
+ - Resolve large GitHub Actions annotated-tag inventories through a single Git exchange so stale cache reviews do not time out on repositories such as codecov/codecov-action.
43
+
44
+ - Replace refreshed GitHub Actions cache inventories instead of retaining obsolete versions and forcing repeated refreshes.
45
+
33
46
  ## [0.3.10] - 2026-08-09
34
47
 
35
48
  - TAG: [v0.3.10][0.3.10t]
@@ -297,7 +310,9 @@ Please file a bug if you notice a violation of semantic versioning.
297
310
  - kettle-jem-template-20260720-005 - Generated README Support & Community rows
298
311
  now include a RubyForum help badge.
299
312
 
300
- [Unreleased]: https://github.com/kettle-dev/kettle-gha-pins/compare/v0.3.10...HEAD
313
+ [Unreleased]: https://github.com/kettle-dev/kettle-gha-pins/compare/v0.3.11...HEAD
314
+ [0.3.11]: https://github.com/kettle-dev/kettle-gha-pins/compare/v0.3.10...v0.3.11
315
+ [0.3.11t]: https://github.com/kettle-dev/kettle-gha-pins/releases/tag/v0.3.11
301
316
  [0.3.10]: https://github.com/kettle-dev/kettle-gha-pins/compare/v0.3.9...v0.3.10
302
317
  [0.3.10t]: https://github.com/kettle-dev/kettle-gha-pins/releases/tag/v0.3.10
303
318
  [0.3.9]: https://github.com/kettle-dev/kettle-gha-pins/compare/v0.3.8...v0.3.9
data/README.md CHANGED
@@ -582,7 +582,7 @@ Thanks for RTFM. ☺️
582
582
  [📌gitmoji]: https://gitmoji.dev
583
583
  [📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
584
584
  [🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
585
- [🧮kloc-img]: https://img.shields.io/badge/KLOC-1.042-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
585
+ [🧮kloc-img]: https://img.shields.io/badge/KLOC-1.065-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
586
586
  [🔐security]: https://github.com/kettle-dev/kettle-gha-pins/blob/main/SECURITY.md
587
587
  [🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
588
588
  [📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "json"
4
4
  require "net/http"
5
+ require "open3"
5
6
  require "timeout"
6
7
  require "uri"
7
8
 
@@ -10,6 +11,7 @@ module Kettle
10
11
  module Pins
11
12
  # Lightweight GitHub API client for commit and release SHA resolution.
12
13
  class GitHubClient
14
+ ANNOTATED_TAG_GIT_FALLBACK_THRESHOLD = 4
13
15
  class CacheMissError < Error; end
14
16
  class RefreshError < Error; end
15
17
 
@@ -150,7 +152,7 @@ module Kettle
150
152
  data = request_json("/repos/#{repo_ref}/git/matching-refs/tags/")
151
153
  return nil unless data.is_a?(Array)
152
154
 
153
- data.each_with_object({}) do |entry, memo|
155
+ entries = data.each_with_object([]) do |entry, memo|
154
156
  ref = entry["ref"].to_s
155
157
  next unless ref.start_with?("refs/tags/")
156
158
 
@@ -160,16 +162,51 @@ module Kettle
160
162
  object = entry["object"]
161
163
  next unless object.is_a?(Hash)
162
164
 
163
- sha = object["sha"].to_s[0, 40]
164
- case object["type"]
165
+ memo << [tag, object["type"].to_s, object["sha"].to_s[0, 40]]
166
+ end
167
+ annotated_tag_shas = git_tag_ref_shas(repo_ref) if entries.count { |_, type, _| type == "tag" } > ANNOTATED_TAG_GIT_FALLBACK_THRESHOLD
168
+
169
+ entries.each_with_object({}) do |(tag, type, sha), memo|
170
+ case type
165
171
  when "commit"
166
172
  memo[tag] = sha
167
173
  when "tag"
168
- memo[tag] = annotated_tag_commit_sha(repo_ref, sha)
174
+ memo[tag] = annotated_tag_shas&.fetch(tag, nil) || annotated_tag_commit_sha(repo_ref, sha)
169
175
  end
170
176
  end
171
177
  end
172
178
 
179
+ # The REST API exposes annotated tags as tag objects, requiring one
180
+ # additional request per tag to reach the commit. A single Git
181
+ # protocol exchange returns both tag objects and peeled commit refs,
182
+ # avoiding a refresh timeout for repositories with large tag histories.
183
+ def git_tag_ref_shas(repo_ref)
184
+ return unless @api_base.to_s.sub(%r{/\z}, "") == API_BASE
185
+
186
+ stdout, _stderr, status = Open3.capture3(
187
+ {"GIT_TERMINAL_PROMPT" => "0"},
188
+ "git",
189
+ "ls-remote",
190
+ "--tags",
191
+ "https://github.com/#{repo_ref}.git"
192
+ )
193
+ return unless status.success?
194
+
195
+ stdout.each_line.each_with_object({}) do |line, memo|
196
+ sha, ref = line.split
197
+ next unless SHA_RE.match?(sha.to_s)
198
+ next unless ref.to_s.start_with?("refs/tags/")
199
+
200
+ peeled = ref.end_with?("^{}")
201
+ tag = ref.sub(%r{\Arefs/tags/}, "").sub(/\^\{\}\z/, "")
202
+ next unless VersionRubric.parse(tag)
203
+
204
+ memo[tag] = sha if peeled || !memo.key?(tag)
205
+ end
206
+ rescue IOError, SystemCallError
207
+ nil
208
+ end
209
+
173
210
  def annotated_tag_commit_sha(repo_ref, tag_sha)
174
211
  return nil if tag_sha.to_s.empty?
175
212
 
@@ -54,8 +54,15 @@ module Kettle
54
54
  return if repo_ref.to_s.empty?
55
55
 
56
56
  action = data.fetch("actions")[repo_ref] ||= {}
57
- stored_versions = action["versions"] ||= {}
58
- refs = action["refs"] ||= {}
57
+ previous_versions = action["versions"] || {}
58
+ previous_tags = previous_versions.values.each_with_object([]) do |entry, tags|
59
+ tag = entry["tag"].to_s
60
+ tags << tag unless tag.empty?
61
+ end
62
+ stored_versions = {}
63
+ refs = (action["refs"] || {}).reject { |ref, _entry| previous_tags.include?(ref) }
64
+ action["versions"] = stored_versions
65
+ action["refs"] = refs
59
66
  timestamp = @clock.call.utc.iso8601
60
67
 
61
68
  versions.each do |entry|
@@ -6,7 +6,7 @@ module Kettle
6
6
  # Version namespace for this gem.
7
7
  module Version
8
8
  # Current gem version.
9
- VERSION = "0.3.10"
9
+ VERSION = "0.3.11"
10
10
  end
11
11
  # Current gem version exposed at the traditional constant location.
12
12
  VERSION = Version::VERSION # Traditional Constant Location
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kettle-gha-pins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.10
4
+ version: 0.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter H. Boling
@@ -301,10 +301,10 @@ licenses:
301
301
  - MIT
302
302
  metadata:
303
303
  homepage_uri: https://github.com/kettle-dev/kettle-gha-pins
304
- source_code_uri: https://github.com/kettle-dev/kettle-gha-pins/tree/v0.3.10
305
- changelog_uri: https://github.com/kettle-dev/kettle-gha-pins/blob/v0.3.10/CHANGELOG.md
304
+ source_code_uri: https://github.com/kettle-dev/kettle-gha-pins/tree/v0.3.11
305
+ changelog_uri: https://github.com/kettle-dev/kettle-gha-pins/blob/v0.3.11/CHANGELOG.md
306
306
  bug_tracker_uri: https://github.com/kettle-dev/kettle-gha-pins/issues
307
- documentation_uri: https://www.rubydoc.info/gems/kettle-gha-pins/0.3.10
307
+ documentation_uri: https://www.rubydoc.info/gems/kettle-gha-pins/0.3.11
308
308
  funding_uri: https://github.com/sponsors/pboling
309
309
  wiki_uri: https://github.com/kettle-dev/kettle-gha-pins/wiki
310
310
  news_uri: https://www.railsbling.com/tags/kettle-gha-pins
metadata.gz.sig CHANGED
Binary file