dependabot-common 0.111.4 → 0.111.5

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: 998e71dd1ec457900c3bca8e0cd31c426c4506b32d01032c43cf4d1bf517f3f8
4
- data.tar.gz: aa5af7f173579faa87ab15ff7ff4df8271f13d8a50d419999c7bfc4de1fd7fc9
3
+ metadata.gz: ed235a15ba5b7800e7227df7c0e427e78e68d205b48136518fadb21032fc313b
4
+ data.tar.gz: f2e1477bdbff73b96418d58cbf9cd202cab706aac9e657b64dd0be9036f1a348
5
5
  SHA512:
6
- metadata.gz: 01af66663ecd9916661e4320cc31e2ad208e48b0d0b564365d72e24e44ec8082c57f0b85fbde33cbb740f87dd40a420da7838643010876640aef1619cf9bfd6d
7
- data.tar.gz: e5a5bc7f2ebb2b6d72d5078bae28cd1c8b145c8f4f491ad2c4680d93300c71a47a255a78d5d4f3d908eed735b4172acb0db74dbd6a7a73da354c18a5722b5b5a
6
+ metadata.gz: 6e99214b62105c357d9009b345a4dd3857badcd63e5da2856a4f45b6b30b9723382a18f75e8310dc6d209fc003b896f6e8c37c3ba89a583c9f3d76455d3fb4f9
7
+ data.tar.gz: 49fa885e74495ba1971141936cd62706e3a0c2f23a69cf147648ef8f046a6d665033e34251c3abd96f070136f4833d118072e609e337db7718c1a0a1e0b0b86e
@@ -123,7 +123,8 @@ module Dependabot
123
123
  JSON.parse(response.body).fetch("value")
124
124
  end
125
125
 
126
- def create_commit(branch_name, base_commit, commit_message, files)
126
+ def create_commit(branch_name, base_commit, commit_message, files,
127
+ author_details)
127
128
  content = {
128
129
  refUpdates: [
129
130
  { name: "refs/heads/" + branch_name, oldObjectId: base_commit }
@@ -131,6 +132,7 @@ module Dependabot
131
132
  commits: [
132
133
  {
133
134
  comment: commit_message,
135
+ author: author_details,
134
136
  changes: files.map do |file|
135
137
  {
136
138
  changeType: "edit",
@@ -141,7 +143,7 @@ module Dependabot
141
143
  }
142
144
  }
143
145
  end
144
- }
146
+ }.compact
145
147
  ]
146
148
  }
147
149
 
@@ -152,7 +154,8 @@ module Dependabot
152
154
 
153
155
  def create_pull_request(pr_name, source_branch, target_branch,
154
156
  pr_description, labels)
155
- # Azure DevOps only support descriptions up to 4000 characters (https://developercommunity.visualstudio.com/content/problem/608770/remove-4000-character-limit-on-pull-request-descri.html)
157
+ # Azure DevOps only support descriptions up to 4000 characters
158
+ # https://developercommunity.visualstudio.com/content/problem/608770/remove-4000-character-limit-on-pull-request-descri.html
156
159
  azure_max_length = 3999
157
160
  if pr_description.length > azure_max_length
158
161
  truncated_msg = "...\n\n_Description has been truncated_"
@@ -132,6 +132,7 @@ module Dependabot
132
132
  commit_message: message_builder.commit_message,
133
133
  pr_description: message_builder.pr_message,
134
134
  pr_name: message_builder.pr_name,
135
+ author_details: author_details,
135
136
  labeler: labeler
136
137
  )
137
138
  end
@@ -8,11 +8,11 @@ module Dependabot
8
8
  class Azure
9
9
  attr_reader :source, :branch_name, :base_commit, :credentials,
10
10
  :files, :commit_message, :pr_description, :pr_name,
11
- :labeler
11
+ :author_details, :labeler
12
12
 
13
13
  def initialize(source:, branch_name:, base_commit:, credentials:,
14
14
  files:, commit_message:, pr_description:, pr_name:,
15
- labeler:)
15
+ author_details:, labeler:)
16
16
  @source = source
17
17
  @branch_name = branch_name
18
18
  @base_commit = base_commit
@@ -21,13 +21,16 @@ module Dependabot
21
21
  @commit_message = commit_message
22
22
  @pr_description = pr_description
23
23
  @pr_name = pr_name
24
+ @author_details = author_details
24
25
  @labeler = labeler
25
26
  end
26
27
 
27
28
  def create
28
29
  return if branch_exists? && pull_request_exists?
29
30
 
30
- create_commit unless branch_exists? && commit_exists?
31
+ # For Azure we create or update a branch in the same request as creating
32
+ # a commit (so we don't need create or update branch logic here)
33
+ create_commit
31
34
 
32
35
  create_pull_request
33
36
  end
@@ -43,20 +46,13 @@ module Dependabot
43
46
  end
44
47
 
45
48
  def branch_exists?
46
- @branch_ref ||=
47
- azure_client_for_source.branch(branch_name)
49
+ @branch_ref ||= azure_client_for_source.branch(branch_name)
48
50
 
49
51
  @branch_ref
50
52
  rescue ::Azure::Error::NotFound
51
53
  false
52
54
  end
53
55
 
54
- def commit_exists?
55
- @commits ||=
56
- azure_client_for_source.commits(branch_name)
57
- commit_message.start_with?(@commits.first.fetch("comment"))
58
- end
59
-
60
56
  def pull_request_exists?
61
57
  azure_client_for_source.pull_requests(
62
58
  branch_name,
@@ -65,11 +61,15 @@ module Dependabot
65
61
  end
66
62
 
67
63
  def create_commit
64
+ author = author_details&.slice(:name, :email, :date)
65
+ author = nil unless author&.any?
66
+
68
67
  azure_client_for_source.create_commit(
69
68
  branch_name,
70
69
  base_commit,
71
70
  commit_message,
72
- files
71
+ files,
72
+ author
73
73
  )
74
74
  end
75
75
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dependabot
4
- VERSION = "0.111.4"
4
+ VERSION = "0.111.5"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.111.4
4
+ version: 0.111.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-11 00:00:00.000000000 Z
11
+ date: 2019-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-ecr