dependabot-common 0.168.0 → 0.169.3

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: 427cfd662176d25750a84eff74448ac6a4bb83bdbad91499ce097789208b0fc8
4
- data.tar.gz: f0c8f21a2d13f6ade2159d38e3d3c2a663d89c5195941e1d98c7fc843975cd14
3
+ metadata.gz: b8a205305372fc94bc744bbc8d398e31761ce36a3885f7883d550aa3f63af865
4
+ data.tar.gz: da55d148ed2f839749d5b5aa39da62917135794fb217fe6705f95ee01701f5fe
5
5
  SHA512:
6
- metadata.gz: ad8438cd7fd6ca00b0618369b9d2ecee382f2945e4516f2e6a22e478dfbc6c64c7da0067c899e5efa058c5304bc948d3de31cb61cd09a0487ed9c0d41cbca64a
7
- data.tar.gz: 36b35131e863bb8308dd215161320e2af7bcce80b7d488a254c37169eb03c298bcf9473f9273ed580ee45aa6d744a85a9c2bd378a4f62b3d9cf22d5fad17eaba
6
+ metadata.gz: a690bcd061ba9d5e2e45f22b63d10149928e828bfa3e4ad30514cc0fbd083916aa5e46251cd5b3157e56a535752080824c2d4c15352ed876d6482be60e96bb78
7
+ data.tar.gz: 28aa3a165cb01d33dea1b9d8d8a897cf569979a88ff8f5103c57180b0d4c9ab4e21c4465325ef722106d1d825dc817f110b887fb1c84ab0335bd88d8ae0b372a
@@ -9,6 +9,8 @@ module Dependabot
9
9
  class PullRequestCreator
10
10
  # rubocop:disable Metrics/ClassLength
11
11
  class Github
12
+ MAX_PR_DESCRIPTION_LENGTH = 65_536 # characters (see #create_pull_request)
13
+
12
14
  attr_reader :source, :branch_name, :base_commit, :credentials,
13
15
  :files, :pr_description, :pr_name, :commit_message,
14
16
  :author_details, :signature_key, :custom_headers,
@@ -347,6 +349,18 @@ module Dependabot
347
349
  end
348
350
 
349
351
  def create_pull_request
352
+ # Limit PR description to MAX_PR_DESCRIPTION_LENGTH (65,536) characters
353
+ # and truncate with message if over. The API limit is 262,144 bytes
354
+ # (https://github.community/t/maximum-length-for-the-comment-body-in-issues-and-pr/148867/2).
355
+ # As Ruby strings are UTF-8 encoded, this is a pessimistic limit: it
356
+ # presumes the case where all characters are 4 bytes.
357
+ pr_description = @pr_description.dup
358
+ if pr_description && pr_description.length > MAX_PR_DESCRIPTION_LENGTH
359
+ truncated_msg = "...\n\n_Description has been truncated_"
360
+ truncate_length = MAX_PR_DESCRIPTION_LENGTH - truncated_msg.length
361
+ pr_description = (pr_description[0, truncate_length] + truncated_msg)
362
+ end
363
+
350
364
  github_client_for_source.create_pull_request(
351
365
  source.repo,
352
366
  target_branch,
@@ -280,10 +280,10 @@ module Dependabot
280
280
  FileUtils.mv(backup_path, GIT_CONFIG_GLOBAL_PATH)
281
281
  end
282
282
 
283
- def self.run_shell_command(command, allow_unsafe_shell_command: false)
283
+ def self.run_shell_command(command, allow_unsafe_shell_command: false, env: {})
284
284
  start = Time.now
285
285
  cmd = allow_unsafe_shell_command ? command : escape_command(command)
286
- stdout, process = Open3.capture2e(cmd)
286
+ stdout, process = Open3.capture2e(env || {}, cmd)
287
287
  time_taken = Time.now - start
288
288
 
289
289
  # Raise an error with the output from the shell session if the
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dependabot
4
- VERSION = "0.168.0"
4
+ VERSION = "0.169.3"
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.168.0
4
+ version: 0.169.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-23 00:00:00.000000000 Z
11
+ date: 2021-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -469,7 +469,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
469
469
  - !ruby/object:Gem::Version
470
470
  version: 2.7.3
471
471
  requirements: []
472
- rubygems_version: 3.2.22
472
+ rubygems_version: 3.2.32
473
473
  signing_key:
474
474
  specification_version: 4
475
475
  summary: Shared code used between Dependabot package managers