File tree Expand file tree Collapse file tree
lib/dependabot/github_actions
spec/dependabot/github_actions Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55
66require "dependabot/file_fetchers"
77require "dependabot/file_fetchers/base"
8+ require "dependabot/experiments"
89require "dependabot/github_actions/constants"
910
1011module Dependabot
@@ -79,6 +80,7 @@ def fetch_files
7980 # repository workflows. Composite-action directories cannot own a lockfile.
8081 sig { returns ( T . nilable ( DependencyFile ) ) }
8182 def actions_lockfile
83+ return unless Dependabot ::Experiments . enabled? ( :github_actions_lockfile )
8284 return unless source . hostname == GITHUB_COM
8385 return fetch_file_if_present ( LOCKFILE_PATH ) if directory == "/"
8486
Original file line number Diff line number Diff line change 9191
9292 context "when an actions.lock is present" do
9393 before do
94+ Dependabot ::Experiments . register ( :github_actions_lockfile , true )
9495 stub_request ( :get , url + ".github/workflows?ref=sha" )
9596 . with ( headers : { "Authorization" => "token token" } )
9697 . to_return (
117118
118119 context "when an actions.lock is present" do
119120 before do
121+ Dependabot ::Experiments . register ( :github_actions_lockfile , true )
120122 # Re-stub the workflows listing to include the lockfile alongside the
121123 # workflow files, then stub the lockfile content fetch.
122124 stub_request ( :get , url + ".github/workflows?ref=sha" )
146148 )
147149 end
148150
151+ context "when the experiment is disabled" do
152+ before { Dependabot ::Experiments . reset! }
153+
154+ it "keeps the existing workflow-only behavior" do
155+ expect ( file_fetcher_instance . files . map ( &:name ) )
156+ . to match_array (
157+ %w( .github/workflows/sherlock-workflow.yaml
158+ .github/workflows/integration-workflow.yml )
159+ )
160+ expect ( a_request ( :get , url + ".github/workflows/actions.lock?ref=sha" ) ) . not_to have_been_made
161+ end
162+ end
163+
149164 context "with a non-github.com source" do
150165 let ( :credentials ) do
151166 [ {
210225
211226 context "when an actions.lock is present" do
212227 before do
228+ Dependabot ::Experiments . register ( :github_actions_lockfile , true )
213229 stub_request ( :get , url + ".github/workflows?ref=sha" )
214230 . with ( headers : { "Authorization" => "token token" } )
215231 . to_return (
You can’t perform that action at this time.
0 commit comments