dependabot-github_actions 0.291.0 → 0.292.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dependabot/github_actions/constants.rb +44 -0
- data/lib/dependabot/github_actions/file_fetcher.rb +10 -8
- data/lib/dependabot/github_actions/file_parser.rb +27 -16
- data/lib/dependabot/github_actions/file_updater.rb +3 -2
- data/lib/dependabot/github_actions/metadata_finder.rb +2 -2
- data/lib/dependabot/github_actions/package_manager.rb +40 -0
- data/lib/dependabot/github_actions/update_checker.rb +1 -0
- data/lib/dependabot/github_actions.rb +2 -0
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec9317297cf1d6f91689b4dbfd495361463c4da20b5e1cdfb8b1bec345fb6fdc
|
4
|
+
data.tar.gz: 108569a3859425a5c8120fa66f9f04f1a93d24f4d394ba6b36d19e5431e02071
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fbf5b457cf937c2b4856b6a2993c229b10218d541d288f31e4c80c36a84e75a3505b229057484dbd5e19fad22c7a4a99a9c3e9aa72e643e54abbc39cdb668aa
|
7
|
+
data.tar.gz: f2618bb10546af53d065eb2364fd0de958fdf98537b9de8d163d6191fd5c4ad3fa8714bb0688bc481a7aa977b6361ab05c01564323bb03e2280e0fe5eb23dc44
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# typed: strong
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Dependabot
|
5
|
+
module GithubActions
|
6
|
+
# Reference to the GitHub.com domain
|
7
|
+
GITHUB_COM = T.let("github.com", String)
|
8
|
+
|
9
|
+
# Regular expression to match a GitHub repository reference
|
10
|
+
GITHUB_REPO_REFERENCE = T.let(%r{
|
11
|
+
^(?<owner>[\w.-]+)/
|
12
|
+
(?<repo>[\w.-]+)
|
13
|
+
(?<path>/[^\@]+)?
|
14
|
+
@(?<ref>.+)
|
15
|
+
}x, Regexp)
|
16
|
+
|
17
|
+
# Matches .yml or .yaml files in the .github/workflows directories
|
18
|
+
WORKFLOW_YAML_REGEX = %r{\.github/workflows/.+\.ya?ml$}
|
19
|
+
# Matches .yml or .yaml files anywhere
|
20
|
+
ALL_YAML_FILES = %r{(?:^|/).+\.ya?ml$}
|
21
|
+
|
22
|
+
# The ecosystem name for GitHub Actions
|
23
|
+
ECOSYSTEM = T.let("github_actions", String)
|
24
|
+
|
25
|
+
# The pattern to match manifest files
|
26
|
+
MANIFEST_FILE_PATTERN = /\.ya?ml$/
|
27
|
+
# The name of the manifest file
|
28
|
+
MANIFEST_FILE_YML = T.let("action.yml", String)
|
29
|
+
# The name of the manifest file
|
30
|
+
MANIFEST_FILE_YAML = T.let("action.yaml", String)
|
31
|
+
# The pattern to match any .yml or .yaml file
|
32
|
+
ANYTHING_YML = T.let("<anything>.yml", String)
|
33
|
+
# The path to the workflow directory
|
34
|
+
WORKFLOW_DIRECTORY = T.let(".github/workflows", String)
|
35
|
+
# The path to the config .yml file
|
36
|
+
CONFIG_YMLS = T.let("#{WORKFLOW_DIRECTORY}/#{ANYTHING_YML}".freeze, String)
|
37
|
+
|
38
|
+
OWNER_KEY = T.let("owner", String)
|
39
|
+
REPO_KEY = T.let("repo", String)
|
40
|
+
REF_KEY = T.let("ref", String)
|
41
|
+
USES_KEY = T.let("uses", String)
|
42
|
+
STEPS_KEY = T.let("steps", String)
|
43
|
+
end
|
44
|
+
end
|
@@ -5,6 +5,7 @@ require "sorbet-runtime"
|
|
5
5
|
|
6
6
|
require "dependabot/file_fetchers"
|
7
7
|
require "dependabot/file_fetchers/base"
|
8
|
+
require "dependabot/github_actions/constants"
|
8
9
|
|
9
10
|
module Dependabot
|
10
11
|
module GithubActions
|
@@ -12,11 +13,9 @@ module Dependabot
|
|
12
13
|
extend T::Sig
|
13
14
|
extend T::Helpers
|
14
15
|
|
15
|
-
FILENAME_PATTERN = /\.ya?ml$/
|
16
|
-
|
17
16
|
sig { override.params(filenames: T::Array[String]).returns(T::Boolean) }
|
18
17
|
def self.required_files_in?(filenames)
|
19
|
-
filenames.any? { |f| f.match?(
|
18
|
+
filenames.any? { |f| f.match?(MANIFEST_FILE_PATTERN) }
|
20
19
|
end
|
21
20
|
|
22
21
|
sig { override.returns(String) }
|
@@ -49,9 +48,9 @@ module Dependabot
|
|
49
48
|
if incorrectly_encoded_workflow_files.none?
|
50
49
|
expected_paths =
|
51
50
|
if directory == "/"
|
52
|
-
File.join(directory,
|
51
|
+
File.join(directory, MANIFEST_FILE_YML) + " or /#{CONFIG_YMLS}"
|
53
52
|
else
|
54
|
-
File.join(directory,
|
53
|
+
File.join(directory, ANYTHING_YML)
|
55
54
|
end
|
56
55
|
|
57
56
|
raise(
|
@@ -75,16 +74,19 @@ module Dependabot
|
|
75
74
|
# In the special case where the root directory is defined we also scan
|
76
75
|
# the .github/workflows/ folder.
|
77
76
|
if directory == "/"
|
78
|
-
@workflow_files += [
|
77
|
+
@workflow_files += [
|
78
|
+
fetch_file_if_present(MANIFEST_FILE_YML),
|
79
|
+
fetch_file_if_present(MANIFEST_FILE_YAML)
|
80
|
+
].compact
|
79
81
|
|
80
|
-
workflows_dir =
|
82
|
+
workflows_dir = WORKFLOW_DIRECTORY
|
81
83
|
else
|
82
84
|
workflows_dir = "."
|
83
85
|
end
|
84
86
|
|
85
87
|
@workflow_files +=
|
86
88
|
repo_contents(dir: workflows_dir, raise_errors: false)
|
87
|
-
.select { |f| f.type == "file" && f.name.match?(
|
89
|
+
.select { |f| f.type == "file" && f.name.match?(MANIFEST_FILE_PATTERN) }
|
88
90
|
.map { |f| fetch_file_from_host("#{workflows_dir}/#{f.name}") }
|
89
91
|
end
|
90
92
|
|
@@ -8,7 +8,9 @@ require "dependabot/dependency"
|
|
8
8
|
require "dependabot/errors"
|
9
9
|
require "dependabot/file_parsers"
|
10
10
|
require "dependabot/file_parsers/base"
|
11
|
+
require "dependabot/github_actions/constants"
|
11
12
|
require "dependabot/github_actions/version"
|
13
|
+
require "dependabot/github_actions/package_manager"
|
12
14
|
|
13
15
|
# For docs, see
|
14
16
|
# https://help.github.com/en/articles/configuring-a-workflow#referencing-actions-in-your-workflow
|
@@ -20,13 +22,6 @@ module Dependabot
|
|
20
22
|
|
21
23
|
require "dependabot/file_parsers/base/dependency_set"
|
22
24
|
|
23
|
-
GITHUB_REPO_REFERENCE = %r{
|
24
|
-
^(?<owner>[\w.-]+)/
|
25
|
-
(?<repo>[\w.-]+)
|
26
|
-
(?<path>/[^\@]+)?
|
27
|
-
@(?<ref>.+)
|
28
|
-
}x
|
29
|
-
|
30
25
|
sig { override.returns(T::Array[Dependabot::Dependency]) }
|
31
26
|
def parse
|
32
27
|
dependency_set = DependencySet.new
|
@@ -44,8 +39,24 @@ module Dependabot
|
|
44
39
|
dependency_set.dependencies
|
45
40
|
end
|
46
41
|
|
42
|
+
sig { returns(Ecosystem) }
|
43
|
+
def ecosystem
|
44
|
+
@ecosystem ||= T.let(
|
45
|
+
Ecosystem.new(
|
46
|
+
name: ECOSYSTEM,
|
47
|
+
package_manager: package_manager
|
48
|
+
),
|
49
|
+
T.nilable(Ecosystem)
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
47
53
|
private
|
48
54
|
|
55
|
+
sig { returns(Ecosystem::VersionManager) }
|
56
|
+
def package_manager
|
57
|
+
@package_manager ||= T.let(PackageManager.new, T.nilable(Dependabot::GithubActions::PackageManager))
|
58
|
+
end
|
59
|
+
|
49
60
|
sig { params(file: Dependabot::DependencyFile).returns(Dependabot::FileParsers::Base::DependencySet) }
|
50
61
|
def workfile_file_dependencies(file)
|
51
62
|
dependency_set = DependencySet.new
|
@@ -94,20 +105,20 @@ module Dependabot
|
|
94
105
|
|
95
106
|
sig { params(file: Dependabot::DependencyFile, string: String).returns(Dependabot::Dependency) }
|
96
107
|
def build_github_dependency(file, string)
|
97
|
-
unless source&.hostname ==
|
108
|
+
unless source&.hostname == GITHUB_COM
|
98
109
|
dep = github_dependency(file, string, T.must(source).hostname)
|
99
110
|
git_checker = Dependabot::GitCommitChecker.new(dependency: dep, credentials: credentials)
|
100
111
|
return dep if git_checker.git_repo_reachable?
|
101
112
|
end
|
102
113
|
|
103
|
-
github_dependency(file, string,
|
114
|
+
github_dependency(file, string, GITHUB_COM)
|
104
115
|
end
|
105
116
|
|
106
117
|
sig { params(file: Dependabot::DependencyFile, string: String, hostname: String).returns(Dependabot::Dependency) }
|
107
118
|
def github_dependency(file, string, hostname)
|
108
119
|
details = T.must(string.match(GITHUB_REPO_REFERENCE)).named_captures
|
109
|
-
name = "#{details.fetch(
|
110
|
-
ref = details.fetch(
|
120
|
+
name = "#{details.fetch(OWNER_KEY)}/#{details.fetch(REPO_KEY)}"
|
121
|
+
ref = details.fetch(REF_KEY)
|
111
122
|
version = version_class.new(ref).to_s if version_class.correct?(ref)
|
112
123
|
Dependency.new(
|
113
124
|
name: name,
|
@@ -124,7 +135,7 @@ module Dependabot
|
|
124
135
|
file: file.name,
|
125
136
|
metadata: { declaration_string: string }
|
126
137
|
}],
|
127
|
-
package_manager:
|
138
|
+
package_manager: PackageManager::NAME
|
128
139
|
)
|
129
140
|
end
|
130
141
|
|
@@ -139,11 +150,11 @@ module Dependabot
|
|
139
150
|
|
140
151
|
sig { params(json_object: T::Hash[String, T.untyped], found_uses: T::Array[String]).returns(T::Array[String]) }
|
141
152
|
def deep_fetch_uses_from_hash(json_object, found_uses)
|
142
|
-
if json_object.key?(
|
143
|
-
found_uses << json_object[
|
144
|
-
elsif json_object.key?(
|
153
|
+
if json_object.key?(USES_KEY)
|
154
|
+
found_uses << json_object[USES_KEY]
|
155
|
+
elsif json_object.key?(STEPS_KEY)
|
145
156
|
# Bypass other fields as uses are under steps if they exist
|
146
|
-
deep_fetch_uses(json_object[
|
157
|
+
deep_fetch_uses(json_object[STEPS_KEY], found_uses)
|
147
158
|
else
|
148
159
|
json_object.values.flat_map { |obj| deep_fetch_uses(obj, found_uses) }
|
149
160
|
end
|
@@ -6,6 +6,7 @@ require "sorbet-runtime"
|
|
6
6
|
require "dependabot/errors"
|
7
7
|
require "dependabot/file_updaters"
|
8
8
|
require "dependabot/file_updaters/base"
|
9
|
+
require "dependabot/github_actions/constants"
|
9
10
|
|
10
11
|
module Dependabot
|
11
12
|
module GithubActions
|
@@ -16,10 +17,10 @@ module Dependabot
|
|
16
17
|
def self.updated_files_regex
|
17
18
|
[
|
18
19
|
# Matches .yml or .yaml files in the .github/workflows directories
|
19
|
-
|
20
|
+
WORKFLOW_YAML_REGEX,
|
20
21
|
|
21
22
|
# Matches .yml or .yaml files in the root directory or any subdirectory
|
22
|
-
|
23
|
+
ALL_YAML_FILES
|
23
24
|
]
|
24
25
|
end
|
25
26
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require "sorbet-runtime"
|
5
|
-
|
5
|
+
require "dependabot/github_actions/constants"
|
6
6
|
require "dependabot/metadata_finders"
|
7
7
|
require "dependabot/metadata_finders/base"
|
8
8
|
|
@@ -19,7 +19,7 @@ module Dependabot
|
|
19
19
|
|
20
20
|
url =
|
21
21
|
if info.nil?
|
22
|
-
"https
|
22
|
+
"https://#{GITHUB_COM}/#{dependency.name}"
|
23
23
|
else
|
24
24
|
info[:url] || info.fetch("url")
|
25
25
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# typed: strong
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "sorbet-runtime"
|
5
|
+
require "dependabot/github_actions/constants"
|
6
|
+
require "dependabot/github_actions/version"
|
7
|
+
require "dependabot/ecosystem"
|
8
|
+
require "dependabot/github_actions/requirement"
|
9
|
+
|
10
|
+
module Dependabot
|
11
|
+
module GithubActions
|
12
|
+
class PackageManager < Dependabot::Ecosystem::VersionManager
|
13
|
+
extend T::Sig
|
14
|
+
|
15
|
+
# The package manager name for GitHub Actions
|
16
|
+
NAME = T.let("github_actions", String)
|
17
|
+
|
18
|
+
# The version of the package manager
|
19
|
+
VERSION = T.let("1.0.0", String)
|
20
|
+
|
21
|
+
sig { void }
|
22
|
+
def initialize
|
23
|
+
super(
|
24
|
+
name: NAME,
|
25
|
+
version: Version.new(VERSION)
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
sig { override.returns(T::Boolean) }
|
30
|
+
def deprecated?
|
31
|
+
false
|
32
|
+
end
|
33
|
+
|
34
|
+
sig { override.returns(T::Boolean) }
|
35
|
+
def unsupported?
|
36
|
+
false
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
# These all need to be required so the various classes can be registered in a
|
5
5
|
# lookup table of package manager names to concrete classes.
|
6
|
+
require "dependabot/github_actions/constants"
|
6
7
|
require "dependabot/github_actions/file_fetcher"
|
7
8
|
require "dependabot/github_actions/file_parser"
|
8
9
|
require "dependabot/github_actions/update_checker"
|
@@ -10,6 +11,7 @@ require "dependabot/github_actions/file_updater"
|
|
10
11
|
require "dependabot/github_actions/metadata_finder"
|
11
12
|
require "dependabot/github_actions/requirement"
|
12
13
|
require "dependabot/github_actions/version"
|
14
|
+
require "dependabot/github_actions/package_manager"
|
13
15
|
|
14
16
|
require "dependabot/pull_request_creator/labeler"
|
15
17
|
Dependabot::PullRequestCreator::Labeler
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dependabot-github_actions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.292.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dependabot-common
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.292.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.
|
26
|
+
version: 0.292.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: debug
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -243,10 +243,12 @@ extensions: []
|
|
243
243
|
extra_rdoc_files: []
|
244
244
|
files:
|
245
245
|
- lib/dependabot/github_actions.rb
|
246
|
+
- lib/dependabot/github_actions/constants.rb
|
246
247
|
- lib/dependabot/github_actions/file_fetcher.rb
|
247
248
|
- lib/dependabot/github_actions/file_parser.rb
|
248
249
|
- lib/dependabot/github_actions/file_updater.rb
|
249
250
|
- lib/dependabot/github_actions/metadata_finder.rb
|
251
|
+
- lib/dependabot/github_actions/package_manager.rb
|
250
252
|
- lib/dependabot/github_actions/requirement.rb
|
251
253
|
- lib/dependabot/github_actions/update_checker.rb
|
252
254
|
- lib/dependabot/github_actions/version.rb
|
@@ -255,7 +257,7 @@ licenses:
|
|
255
257
|
- MIT
|
256
258
|
metadata:
|
257
259
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
258
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
260
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.292.0
|
259
261
|
post_install_message:
|
260
262
|
rdoc_options: []
|
261
263
|
require_paths:
|
@@ -271,7 +273,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
271
273
|
- !ruby/object:Gem::Version
|
272
274
|
version: 3.1.0
|
273
275
|
requirements: []
|
274
|
-
rubygems_version: 3.5.
|
276
|
+
rubygems_version: 3.5.22
|
275
277
|
signing_key:
|
276
278
|
specification_version: 4
|
277
279
|
summary: Provides Dependabot support for GitHub Actions
|