dependabot-nuget 0.183.0 → 0.184.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: a87dfd817392cff6f90735dcc923ead81e258ac9727cf3b46a0c6ac7217df781
4
- data.tar.gz: 405b359f330e1d7ba188946d7c4e90c93cdbbb67ba1f693d2b4e3560404a8760
3
+ metadata.gz: 8a7799a0af5cc3fab79ef0f865895d44c4ae7825745545b308471d17f44dd5c9
4
+ data.tar.gz: 60bc1e057afa18731a0d61994eda2255be633cf19ea95da7c022210f05f847a3
5
5
  SHA512:
6
- metadata.gz: 22f1c7c4725f97248d0a8327b0d51fdb8e91f1ba2f3888ca3c29d10230b890eba0c12584be108d2aa61f696c86edada106251c6b176fde8b022b6e39c9715b56
7
- data.tar.gz: 57eedfed670e6e7c9f6d28baeca3ab152e482702cc699170776536b01ab91e5acaca5eb011c1af4e4ca13110afcf252463b68d5d112b16d13864779c907f9f98
6
+ metadata.gz: 656f946e6c83986d5d5ccb7dc5fa1fc2f51623d5de4dc6d2efeadc3d97d7600680214404f2b5b29d7cb1aca46d6080b326d303c6d6faa7933f2f8e00a99acb5c
7
+ data.tar.gz: 4fbbbbfe93fddd835421a842b18211b56e10381d3829c7c6691a0f9febe64c370cc87e9fe516fc31cd5cfc19dcd7215e37caad81d650e3075659b3020a46c566
@@ -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.183.0
4
+ version: 0.184.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-29 00:00:00.000000000 Z
11
+ date: 2022-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dependabot-common
@@ -16,28 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.183.0
19
+ version: 0.184.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.183.0
27
- - !ruby/object:Gem::Dependency
28
- name: debase
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 0.2.4.1
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 0.2.4.1
26
+ version: 0.184.0
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: debug
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -114,28 +100,14 @@ dependencies:
114
100
  requirements:
115
101
  - - "~>"
116
102
  - !ruby/object:Gem::Version
117
- version: 1.27.0
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: 1.27.0
125
- - !ruby/object:Gem::Dependency
126
- name: ruby-debug-ide
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: 0.7.3
103
+ version: 1.28.2
132
104
  type: :development
133
105
  prerelease: false
134
106
  version_requirements: !ruby/object:Gem::Requirement
135
107
  requirements:
136
108
  - - "~>"
137
109
  - !ruby/object:Gem::Version
138
- version: 0.7.3
110
+ version: 1.28.2
139
111
  - !ruby/object:Gem::Dependency
140
112
  name: simplecov
141
113
  requirement: !ruby/object:Gem::Requirement