dependabot-github_actions 0.403.0 → 0.404.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: '0090593cc564f949e3abef7c548565cd1b2a678aa405e88cc6c4d852ebf575ce'
4
- data.tar.gz: 1125ed0bdbe60e308bf5ad357f0e44afbe58b39c28c7801e38db0d38ab6e7f4f
3
+ metadata.gz: 439ae35a254e6fb3ec27a8dd060058d37c03a05da17b84de0b321d6c4206fd53
4
+ data.tar.gz: 74bc5c6f5ae244fec2f7edb9d764c0f758799d7e2d2fdc4c13ab4a6e8249d5b5
5
5
  SHA512:
6
- metadata.gz: f437b927959898a1756eee795467a34d8c9733bc2f00238e785cbac867344a1f3d4667c4ebdd093e537037fe7fda6b03a356ab6ff4b9522d057ef07456c173ef
7
- data.tar.gz: a84a9e716d0a358694d2d018c7e598455aab46342b73c492d89abc5ff952fabe421bbbe3ed84cfdab2f3e6a197ded3eac40b353d67bd3c6ac176ba70079efe6b
6
+ metadata.gz: faaaa7e87687396144daa0e46dff8b04c4f8f13787d57e1fdccba5cceaf41907415c9992c9d82d21e889d35e70a8637f130387427aee59a761a9c9f04aeeacbc
7
+ data.tar.gz: da9848633ca5f4c5f018ea55c9ee6c90d72651b8dbe25704b666e6ec82b822b9a997d74668478de0a832c64ae3ad60f23c2d76162c26cdd553cbd8e5f78c5eb7
@@ -10,6 +10,7 @@ require "dependabot/errors"
10
10
  require "dependabot/git_tag_with_detail"
11
11
  require "dependabot/github_actions/containing_branch_finder"
12
12
  require "dependabot/github_actions/helpers"
13
+ require "dependabot/github_actions/repository_cloner"
13
14
  require "dependabot/github_actions/requirement"
14
15
  require "dependabot/github_actions/update_checker"
15
16
  require "dependabot/github_actions/version"
@@ -230,10 +231,7 @@ module Dependabot
230
231
  SharedHelpers.in_a_temporary_directory(File.dirname(source.repo)) do |temp_dir|
231
232
  repo_contents_path = File.join(temp_dir, File.basename(source.repo))
232
233
 
233
- SharedHelpers.run_shell_command(
234
- "git clone --no-recurse-submodules #{url} #{repo_contents_path}",
235
- fingerprint: "git clone --no-recurse-submodules <url> <path>"
236
- )
234
+ RepositoryCloner.clone(url: T.must(url), path: repo_contents_path)
237
235
 
238
236
  Dir.chdir(repo_contents_path) do
239
237
  ref_branch = ContainingBranchFinder.find(
@@ -0,0 +1,38 @@
1
+ # typed: strong
2
+ # frozen_string_literal: true
3
+
4
+ require "fileutils"
5
+ require "sorbet-runtime"
6
+
7
+ require "dependabot/logger"
8
+ require "dependabot/shared_helpers"
9
+
10
+ module Dependabot
11
+ module GithubActions
12
+ module RepositoryCloner
13
+ extend T::Sig
14
+
15
+ # Callers only read commits and tags (containing-branch lookup, tag and commit dates), so
16
+ # skip trees and blobs: a full clone of a large repository can fill the disk or time out.
17
+ # Git fetches a missing tree on demand if a later command needs one.
18
+ # Fall back to a full clone if the server or proxy rejects the partial clone, so a lookup
19
+ # never does worse than before.
20
+ sig { params(url: String, path: String, bare: T::Boolean).void }
21
+ def self.clone(url:, path:, bare: false)
22
+ mode = bare ? "--bare" : "--no-checkout"
23
+ SharedHelpers.run_shell_command(
24
+ "git clone #{mode} --filter=tree:0 --no-recurse-submodules #{url} #{path}",
25
+ fingerprint: "git clone #{mode} --filter=tree:0 --no-recurse-submodules <url> <path>"
26
+ )
27
+ rescue SharedHelpers::HelperSubprocessFailed => e
28
+ Dependabot.logger.warn("Partial clone failed, falling back to a full clone: #{e.message.strip}")
29
+ FileUtils.rm_rf(path)
30
+ full_clone_options = bare ? "--bare --no-recurse-submodules" : "--no-recurse-submodules"
31
+ SharedHelpers.run_shell_command(
32
+ "git clone #{full_clone_options} #{url} #{path}",
33
+ fingerprint: "git clone #{full_clone_options} <url> <path>"
34
+ )
35
+ end
36
+ end
37
+ end
38
+ end
@@ -11,6 +11,7 @@ require "dependabot/github_actions/package/package_details_fetcher"
11
11
  require "dependabot/github_actions/requirement"
12
12
  require "dependabot/github_actions/update_checker"
13
13
  require "dependabot/github_actions/helpers"
14
+ require "dependabot/github_actions/repository_cloner"
14
15
  require "dependabot/package/package_latest_version_finder"
15
16
  require "dependabot/shared_helpers"
16
17
  require "dependabot/update_checkers/cooldown_calculation"
@@ -349,7 +350,7 @@ module Dependabot
349
350
  SharedHelpers.in_a_temporary_directory(File.dirname(source.repo)) do |temp_dir|
350
351
  repo_contents_path = File.join(temp_dir, File.basename(source.repo))
351
352
 
352
- SharedHelpers.run_shell_command("git clone --bare --no-recurse-submodules #{url} #{repo_contents_path}")
353
+ RepositoryCloner.clone(url: T.must(url), path: repo_contents_path, bare: true)
353
354
  Dir.chdir(repo_contents_path) do
354
355
  date = if tag_name
355
356
  tag_date = SharedHelpers.run_shell_command(
@@ -360,10 +361,11 @@ module Dependabot
360
361
  tag_date.empty? ? nil : tag_date
361
362
  end
362
363
 
364
+ # --no-mailmap: in a bare repository git log otherwise reads .mailmap from HEAD's tree,
365
+ # which a tree:0 clone would have to fetch from the remote.
363
366
  date ||= SharedHelpers.run_shell_command(
364
- "git show --no-patch --format=\"%cd\" " \
365
- "--date=iso #{commit_ref}",
366
- fingerprint: "git show --no-patch --format=\"%cd\" --date=iso <commit_ref>"
367
+ "git log -1 --no-mailmap --format=\"%cd\" --date=iso #{commit_ref}",
368
+ fingerprint: "git log -1 --no-mailmap --format=\"%cd\" --date=iso <commit_ref>"
367
369
  ).strip
368
370
 
369
371
  Dependabot.logger.info("Found release date : #{Time.parse(date)}")
@@ -7,6 +7,7 @@ require "dependabot/errors"
7
7
  require "dependabot/git_metadata_fetcher"
8
8
  require "dependabot/github_actions/constants"
9
9
  require "dependabot/github_actions/containing_branch_finder"
10
+ require "dependabot/github_actions/repository_cloner"
10
11
  require "dependabot/github_actions/lockfile/reader"
11
12
  require "dependabot/github_actions/requirement"
12
13
  require "dependabot/github_actions/version"
@@ -240,10 +241,7 @@ module Dependabot
240
241
  SharedHelpers.in_a_temporary_directory(File.dirname(source.repo)) do |temp_dir|
241
242
  repo_contents_path = File.join(temp_dir, File.basename(source.repo))
242
243
 
243
- SharedHelpers.run_shell_command(
244
- "git clone --no-recurse-submodules #{url} #{repo_contents_path}",
245
- fingerprint: "git clone --no-recurse-submodules <url> <path>"
246
- )
244
+ RepositoryCloner.clone(url: T.must(url), path: repo_contents_path)
247
245
 
248
246
  Dir.chdir(repo_contents_path) do
249
247
  ref_branch = ContainingBranchFinder.find(
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-github_actions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.403.0
4
+ version: 0.404.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.403.0
18
+ version: 0.404.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.403.0
25
+ version: 0.404.0
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: debug
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -264,6 +264,7 @@ files:
264
264
  - lib/dependabot/github_actions/metadata_finder.rb
265
265
  - lib/dependabot/github_actions/package/package_details_fetcher.rb
266
266
  - lib/dependabot/github_actions/package_manager.rb
267
+ - lib/dependabot/github_actions/repository_cloner.rb
267
268
  - lib/dependabot/github_actions/requirement.rb
268
269
  - lib/dependabot/github_actions/update_checker.rb
269
270
  - lib/dependabot/github_actions/update_checker/latest_version_finder.rb
@@ -278,7 +279,7 @@ licenses:
278
279
  - MIT
279
280
  metadata:
280
281
  bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
281
- changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.403.0
282
+ changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.404.0
282
283
  rdoc_options: []
283
284
  require_paths:
284
285
  - lib