issue-db 1.3.2 → 1.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 04333aa7c6f8d9cdbe7f640b8a5323d5c0ef42ee2a555c07cd0eafe2d92db6d7
4
- data.tar.gz: 8d6ed788b139c7e68dfaa5e0230670d0a31a0ca36975e3b4126cf84369621af8
3
+ metadata.gz: 3baac4ee11892479812c2b918286ae999bad7a3ffa5b186d5f6a9efc21c69361
4
+ data.tar.gz: f6ea018925f8ccd59da37c0d1fc8b72731b65fa4af8707f2975298c81cca8ddc
5
5
  SHA512:
6
- metadata.gz: e89c5a75b153c9f70eda1e92e7039d58e8bec773bdb739c2c7161172f79fb559a3f93fe50cfe892b336370b05b99b28371a656b83cda7596b0338a5a5e092153
7
- data.tar.gz: 2b9b282f7614ffab3411bb977974c4a764a850ac49d3bc5192a48c38e469548a9a968ae7270327da6ab91d8d5465d835f564f1ffe6cc5122167786090239ba30
6
+ metadata.gz: b5787a854bb97a3cba2e0f1bd854949c025a7df996995413834310de40b93add64d4c40967efe58950cfcfc9a5b8fbda715afc7ba1d1fd928f36bf2525dba9cc
7
+ data.tar.gz: d9a645abf9ce42d7857b700fc7cdc9c65a40890f6ab6771a2a56a044db128db528df0aa1a0b5ee8ab97a638ef6212ed99298b9d225843e3ba2f0ab0a37e037a7
@@ -7,27 +7,33 @@ module IssueDB
7
7
  def update_issue_cache!
8
8
  @log.debug("updating issue cache")
9
9
 
10
- # find all issues in the repo that were created by this library
11
- query = "repo:#{@repo.full_name} label:#{@label}"
12
-
13
- search_response = nil
10
+ issues_response = nil
14
11
  begin
15
- # issues structure: { "total_count": 0, "incomplete_results": false, "items": [<issues>] }
16
- search_response = @client.search_issues(query)
12
+ # This fetches all issues with the specified label from the repository. This label identifies all issues...
13
+ # ... that are managed via this library.
14
+ # The client.auto_paginate setting will handle pagination automatically
15
+ issues_response = @client.issues(@repo.full_name, labels: @label, state: "all")
16
+ rescue Octokit::Unauthorized => e
17
+ # Re-throw authentication errors unchanged for clear user feedback
18
+ raise e
17
19
  rescue StandardError => e
18
- retry_err_msg = "error search_issues() call: #{e.message}"
20
+ # For other errors, wrap with context
21
+ retry_err_msg = "error issues() call: #{e.message}"
19
22
  @log.error(retry_err_msg)
20
23
  raise StandardError, retry_err_msg
21
24
  end
22
25
 
23
- # Safety check to ensure search_response and items are not nil
24
- if search_response.nil? || search_response.items.nil?
25
- @log.error("search_issues returned nil response or nil items")
26
- raise StandardError, "search_issues returned invalid response"
26
+ # Safety check to ensure issues_response is not nil
27
+ if issues_response.nil?
28
+ @log.error("issues API returned nil response")
29
+ raise StandardError, "issues API returned invalid response"
27
30
  end
28
31
 
29
- @log.debug("issue cache updated - cached #{search_response.total_count} issues")
30
- @issues = search_response.items
32
+ # Convert to array if it's a single issue (shouldn't happen with auto_paginate, but safety first)
33
+ issues_response = [issues_response] unless issues_response.is_a?(Array)
34
+
35
+ @log.debug("issue cache updated - cached #{issues_response.length} issues")
36
+ @issues = issues_response
31
37
  @issues_last_updated = Time.now
32
38
  return @issues
33
39
  end
@@ -280,6 +280,12 @@ module IssueDB
280
280
  # Check if retry is explicitly disabled for this call
281
281
  disable_retry = kwargs.delete(:disable_retry) || false
282
282
 
283
+ # For add_label method, also check if disable_retry is in the options hash (last positional arg)
284
+ if method.to_s == "add_label" && args.length >= 4 && args.last.is_a?(Hash)
285
+ options_hash = args.last
286
+ disable_retry = options_hash.delete(:disable_retry) || disable_retry
287
+ end
288
+
283
289
  # Determine the rate limit type based on the method name and arguments
284
290
  rate_limit_type = case method.to_s
285
291
  when /search_/
@@ -10,8 +10,10 @@ module IssueDB
10
10
  @repo.full_name,
11
11
  @label,
12
12
  "000000",
13
- { description: "This issue is managed by the issue-db Ruby library. Please do not remove this label." },
14
- disable_retry: true
13
+ {
14
+ description: "This issue is managed by the issue-db Ruby library. Please do not remove this label.",
15
+ disable_retry: true
16
+ }
15
17
  )
16
18
  rescue StandardError => e
17
19
  if e.message.include?("already_exists")
data/lib/version.rb CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  module IssueDB
4
4
  module Version
5
- VERSION = "1.3.2"
5
+ VERSION = "1.4.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: issue-db
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - runwaylab