dependabot-nuget 0.182.4 → 0.185.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd112f60d5684ef24177b5c8142288d71c8244c7c91bc108c538954d17aab8be
4
- data.tar.gz: ca17802fb58a0e5b97eb6b49c08f373196ce128104e34aabef20e693b1117489
3
+ metadata.gz: 371e6d47e0d0c264bbc29fd3763bdf8d292b8d1b7b8e01924b7d1c39e8500841
4
+ data.tar.gz: 604bedfec7fd7187cbaeca4568a773bf03eb2859077202bffcb316d5e203c75c
5
5
  SHA512:
6
- metadata.gz: 9794bb694a3a33a524d6d99a7695cc8d3202fb708cf5fca9a37bb4788ed214c0eed16c36c4b6f4ea84eacf057ce9b4ae4111f9d6ddebc181962b45b023206bf7
7
- data.tar.gz: 282c8208c99282d83c74e330994d5c478c25e39f963bd50b9aa3998e699b31525450ff177d4bf7cf5a1233d74f942222f0429005a30283a892bfaa8c776b3c98
6
+ metadata.gz: 534a9efa904bf97bf0fd2615103f3e98ce14c29efb65e2d92b4bf523a35e14b768a059af0cd74727444c1ffb2a7cfbaa58181d13dc2e5561087652e816a0b8ec
7
+ data.tar.gz: c21499f7e83e3bf9eea738e4373ab752473294a119bd335a67c34655a4329ae014df748b0ef15aa6957fb2715a20d6544cea0e1aa737ccb1dafdbbb0b28b99d6
@@ -12,7 +12,71 @@ module Dependabot
12
12
  def look_up_source
13
13
  return Source.from_url(dependency_source_url) if dependency_source_url
14
14
 
15
- look_up_source_in_nuspec(dependency_nuspec_file)
15
+ src_repo = look_up_source_in_nuspec(dependency_nuspec_file)
16
+ return src_repo if src_repo
17
+
18
+ # Fallback to getting source from the search result's projectUrl or licenseUrl.
19
+ # GitHub Packages doesn't support getting the `.nuspec`, switch to getting
20
+ # that instead once it is supported.
21
+ src_repo_from_project
22
+ rescue StandardError
23
+ # At this point in the process the PR is ready to be posted, we tried to gather commit
24
+ # and release notes, but have encountered an exception. So let's eat it since it's
25
+ # better to have a PR with no info than error out.
26
+ nil
27
+ end
28
+
29
+ def src_repo_from_project
30
+ source = dependency.requirements.find { |r| r&.fetch(:source) }&.fetch(:source)
31
+ return unless source
32
+
33
+ # Query the service index e.g. https://nuget.pkg.github.com/ORG/index.json
34
+ response = Excon.get(
35
+ source.fetch(:url),
36
+ idempotent: true,
37
+ **SharedHelpers.excon_defaults(headers: { **auth_header, "Accept" => "application/json" })
38
+ )
39
+ return unless response.status == 200
40
+
41
+ # Extract the query url e.g. https://nuget.pkg.github.com/ORG/query
42
+ search_base = extract_search_url(response.body)
43
+ return unless search_base
44
+
45
+ response = Excon.get(
46
+ search_base + "?q=#{dependency.name.downcase}&prerelease=true&semVerLevel=2.0.0",
47
+ idempotent: true,
48
+ **SharedHelpers.excon_defaults(headers: { **auth_header, "Accept" => "application/json" })
49
+ )
50
+ return unless response.status == 200
51
+
52
+ # Find a projectUrl or licenseUrl that look like a source URL
53
+ extract_source_repo(response.body)
54
+ rescue JSON::ParserError
55
+ # Ignored, this is expected for some registries that don't handle these request.
56
+ end
57
+
58
+ def extract_search_url(body)
59
+ JSON.parse(body).
60
+ fetch("resources", []).
61
+ find { |r| r.fetch("@type") == "SearchQueryService" }&.
62
+ fetch("@id")
63
+ end
64
+
65
+ def extract_source_repo(body)
66
+ JSON.parse(body).fetch("data", []).each do |search_result|
67
+ next unless search_result["id"].downcase == dependency.name.downcase
68
+
69
+ if search_result.key?("projectUrl")
70
+ source = Source.from_url(search_result.fetch("projectUrl"))
71
+ return source if source
72
+ end
73
+ if search_result.key?("licenseUrl")
74
+ source = Source.from_url(search_result.fetch("licenseUrl"))
75
+ return source if source
76
+ end
77
+ end
78
+ # failed to find a source URL
79
+ nil
16
80
  end
17
81
 
18
82
  def look_up_source_in_nuspec(nuspec)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-nuget
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.182.4
4
+ version: 0.185.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-26 00:00:00.000000000 Z
11
+ date: 2022-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dependabot-common
@@ -16,28 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.182.4
19
+ version: 0.185.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.182.4
26
+ version: 0.185.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: debase
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.2.4.1
33
+ version: 0.2.3
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.2.3
41
+ - !ruby/object:Gem::Dependency
42
+ name: debase-ruby_core_source
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 0.10.14
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
39
53
  - !ruby/object:Gem::Version
40
- version: 0.2.4.1
54
+ version: 0.10.14
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: debug
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +128,14 @@ dependencies:
114
128
  requirements:
115
129
  - - "~>"
116
130
  - !ruby/object:Gem::Version
117
- version: 1.27.0
131
+ version: 1.28.2
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
136
  - - "~>"
123
137
  - !ruby/object:Gem::Version
124
- version: 1.27.0
138
+ version: 1.28.2
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: ruby-debug-ide
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -253,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
253
267
  - !ruby/object:Gem::Version
254
268
  version: 2.7.0
255
269
  requirements: []
256
- rubygems_version: 3.2.32
270
+ rubygems_version: 3.3.7
257
271
  signing_key:
258
272
  specification_version: 4
259
273
  summary: ".NET (NuGet) support for dependabot"