Skip to content

Commit

Permalink
Throw exception if we can't find an updatable version
Browse files Browse the repository at this point in the history
  • Loading branch information
robaiken committed Dec 17, 2024
1 parent 21cb492 commit 7ee38fe
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions github_actions/lib/dependabot/github_actions/file_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ def parse
dependency_set += workfile_file_dependencies(file)
end

dependencies_without_version = dependency_set.dependencies.select { |dep| dep.version.nil? }
raise UpdateNotPossible, dependencies_without_version.map(&:name) unless dependencies_without_version.empty?

dependency_set.dependencies
end

Expand Down
19 changes: 19 additions & 0 deletions github_actions/spec/dependabot/github_actions/file_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -560,5 +560,24 @@ def mock_service_pack_request(nwo)
end
end
end

context "with an unresolvable version" do
let(:workflow_file_fixture_name) { "unresolved_version.yml" }
let(:service_pack_url) do
"https://github.com/taiki-e/install-action.git/info/refs" \
"?service=git-upload-pack"
end

before do
mock_service_pack_request("taiki-e/install-action")
end

it "raises an UpdateNotPossible error" do
expect { parser.parse }.to raise_error(
Dependabot::UpdateNotPossible,
"The following dependencies could not be updated: taiki-e/install-action"
)
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
on: [push]

name: Integration
jobs:
chore:
steps:
- uses: taiki-e/install-action@nextest

0 comments on commit 7ee38fe

Please sign in to comment.