dependabot-nix 0.400.0 → 0.402.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: 9c43092085abc84998966283a4873a016c473627fc91db6a9facf5583eb8ac4e
4
- data.tar.gz: d058639a9e1e91e7af117705000e152ec17fc87847efaa51df63435353b4f9a9
3
+ metadata.gz: e3bfde27699a8e326f4273ea9ef541785df000510c9027f7404063ddc17aa949
4
+ data.tar.gz: 83e6801e4c714829d62889aa9ba69a5159df67159c4dae848e9fcd8355cada7a
5
5
  SHA512:
6
- metadata.gz: d7793b2f1bd1d389c4fa454ca9ae259d65995be485f5267445f05c590408d75805ad4c41f7085061cbd60c6f82e82126378e2576b518c895701307659475aeab
7
- data.tar.gz: 8bbe0ba8ddc46cb313f52a37ec532e0c429523dcc7cced9936611edcc2872f2478bf96231b9c3cc0b5e08cb75a0eada3b09e882e13a33ac76d03cf8f83fc2306
6
+ metadata.gz: 526966c8e4195dc73657ab9791b2cb9bf64d60ff5ee559d5c170d03559944e4e2c4dc56e071a55d2f0abd248c9779046fa4c340ccc648c6ebf33f6f6ecf11514
7
+ data.tar.gz: 859a61c72241afd980232273d917960c085151dde25e0217d58cd99d499468d1b38110c4dc39fe5eedd57fbacf84015bbe8d7363cbb4d8a40cb2bf43a6ba2b17
@@ -66,11 +66,12 @@ module Dependabot
66
66
  TARGET_COMMITS_TO_FETCH = 500
67
67
  ACTIVITY_TYPES = "push,force_push"
68
68
  SHA_REGEX = /\A[0-9a-f]{40}\z/
69
+ NULL_SHA = "0000000000000000000000000000000000000000"
69
70
  # Heuristic for refs that look like a tag/version rather than a branch
70
71
  # (e.g. `v1.2.3`, `1.2`, `2024.01`). Branch names like `nixos-25.05`
71
72
  # don't match because they don't start with a digit or `v<digit>`.
72
73
  TAG_LIKE_REF_REGEX = /\Av?\d+\./
73
- private_constant :TARGET_COMMITS_TO_FETCH, :ACTIVITY_TYPES, :SHA_REGEX, :TAG_LIKE_REF_REGEX
74
+ private_constant :TARGET_COMMITS_TO_FETCH, :ACTIVITY_TYPES, :SHA_REGEX, :NULL_SHA, :TAG_LIKE_REF_REGEX
74
75
 
75
76
  # Fetch branch-tip history via GitHub's Repo Activity API. Each entry's
76
77
  # `after` SHA was once the actual branch tip — for `nixpkgs` channels
@@ -78,6 +79,13 @@ module Dependabot
78
79
  # endpoint, by contrast, returns intermediate commits that were never
79
80
  # branch tips and may not be cached.
80
81
  #
82
+ # The `activity_type` filter does not narrow the response to pushes, so it
83
+ # also holds `branch_creation` and `branch_deletion` entries. A deletion
84
+ # reports the null SHA as its `after`, which is not a revision anyone can
85
+ # fetch. When the newest entry is a deletion the branch no longer exists
86
+ # and has no releases; an older deletion, followed by the branch being
87
+ # created again, is skipped.
88
+ #
81
89
  # Returns nil when the activity API isn't usable (non-GitHub host,
82
90
  # SHA-pinned ref, missing ref, HTTP error). Callers should fall back to
83
91
  # the existing /commits walker in that case.
@@ -91,7 +99,12 @@ module Dependabot
91
99
  entries = fetch_activity_entries(T.must(url), T.must(ref))
92
100
  return nil unless entries.any?
93
101
 
94
- trim_entries_to_locked_sha(entries)
102
+ if branch_deletion?(T.must(entries.first))
103
+ Dependabot.logger.info("Branch #{ref} of #{url} no longer exists, so #{dependency.name} has no releases")
104
+ return []
105
+ end
106
+
107
+ trim_entries_to_locked_sha(entries.reject { |entry| branch_deletion?(entry) })
95
108
  rescue Octokit::Error => e
96
109
  Dependabot.logger.info(
97
110
  "Repo Activity API failed for #{dependency.name} (#{e.class}: #{e.message}), " \
@@ -141,6 +154,11 @@ module Dependabot
141
154
  result
142
155
  end
143
156
 
157
+ sig { params(entry: Sawyer::Resource).returns(T::Boolean) }
158
+ def branch_deletion?(entry)
159
+ activity_string(entry, :after) == NULL_SHA
160
+ end
161
+
144
162
  sig { params(timestamp: T.nilable(Object)).returns(T.nilable(String)) }
145
163
  def format_timestamp(timestamp)
146
164
  return if timestamp.nil?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-nix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.400.0
4
+ version: 0.402.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 0.400.0
18
+ version: 0.402.0
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 0.400.0
25
+ version: 0.402.0
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: debug
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -265,7 +265,7 @@ licenses:
265
265
  - MIT
266
266
  metadata:
267
267
  bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
268
- changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.400.0
268
+ changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.402.0
269
269
  rdoc_options: []
270
270
  require_paths:
271
271
  - lib