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 @@ -175,7 +175,9 @@ def latest_commit_sha(source_checker)
175175 new_tag = T . must ( latest_version_finder ) . latest_version_tag_respecting_cooldown
176176 new_tag &.fetch ( :commit_sha )
177177 else
178- latest_commit_for_pinned_ref
178+ # Keep SHA rewrites aligned with the checker decision (including cooldown filtering).
179+ latest = latest_version
180+ latest . is_a? ( String ) ? latest : latest_commit_for_pinned_ref
179181 end
180182 end
181183
Original file line number Diff line number Diff line change 742742 end
743743 let ( :local_tag_for_pinned_sha ) { false }
744744 let ( :latest_version_tag ) { nil }
745+ let ( :latest_version ) { nil }
745746
746747 before do
747748 allow ( checker ) . to receive_messages (
748749 latest_version_finder : instance_double (
749750 Dependabot ::GithubActions ::UpdateChecker ::LatestVersionFinder ,
750751 latest_version_tag : latest_version_tag
751752 ) ,
753+ latest_version : latest_version ,
752754 latest_commit_for_pinned_ref : "branch-head-sha"
753755 )
754756 end
763765 let ( :latest_version_tag ) do
764766 { tag : "v2.7.0" , commit_sha : "ee0669bd1cc54295c223e0bb666b733df41de1c5" }
765767 end
768+ let ( :latest_version ) { "cooldown-filtered-sha" }
766769
767- it "falls back to branch head commit behavior " do
768- expect ( checker . send ( :latest_commit_sha , source_checker ) ) . to eq ( "branch-head -sha" )
770+ it "uses the checker latest_version SHA to keep updates aligned " do
771+ expect ( checker . send ( :latest_commit_sha , source_checker ) ) . to eq ( "cooldown-filtered -sha" )
769772 end
770773 end
771774 end
You can’t perform that action at this time.
0 commit comments