Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: raise errors when versions are not supported #31

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions deploy/lib/deployer/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,16 @@ class AutoMergeFailure < BaseError

class VersionCompareFailure < BaseError
end

class RequirementsNotMet < BaseError
def initialize(version)
super(build_message(version))
end

def build_message(version)
"Upgrade does not satisfy requirements. The latest upgradable verison is #{version}. " \
"Verify that the requirement allows for an upgrade to this version and check that all " \
"peer dependencies are satisfied."
end
end
end
13 changes: 13 additions & 0 deletions deploy/lib/deployer/repo/dependabot_pull_request_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Repo
class DependabotPullRequestUpdater < PullRequestUpdater
def run
setup_runner
verify_upgrade_satisfies
create_pr
automerge_pr if config.automerge
end
Expand Down Expand Up @@ -198,6 +199,18 @@ def sanitize_yarnrc_yml(fetcher)
yarnrc_yml_file.content =
yarnrc_yml_file.content.gsub("yarnPath:", "# yarnPath:")
end

def verify_upgrade_satisfies
if Gem::Version.new(resolvable_version) >= Gem::Version.new(version)
return
end

raise RequirementsNotMet, resolvable_version
end

def resolvable_version
checker.latest_resolvable_version
end
end
end
end