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

sync/shared-config: avoid syncing multiple Gemfile*, .ruby-version. #135

Merged
merged 1 commit into from
Jun 14, 2024
Merged
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
14 changes: 11 additions & 3 deletions .github/actions/sync/shared-config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def git(*args)
docs_workflow_yaml = ".github/workflows/docs.yml"
vale_ini = ".vale.ini"

target_gemfile_lock = target_directory_path/"Gemfile.lock"

homebrew_docs = homebrew_repository_path/docs
homebrew_ruby_version =
(homebrew_repository_path/"Library/Homebrew/vendor/portable-ruby-version").read
Expand All @@ -52,7 +54,7 @@ def git(*args)
dependabot_config_yaml["updates"].select! do |update|
case update["package-ecosystem"]
when "bundler"
(target_directory_path/"Gemfile.lock").exist?
target_gemfile_lock.exist?
when "npm"
(target_directory_path/"package.json").exist?
when "docker"
Expand Down Expand Up @@ -128,7 +130,13 @@ def git(*args)
next if target_docs_path.to_s.include?("vendor")

target_docs_path.dirname.mkpath
FileUtils.cp docs_path, target_docs_path

if [ruby_version, "Gemfile", "Gemfile.lock"].include?(docs_path_basename) &&
(target_path/docs_path_basename).exist?
FileUtils.rm target_docs_path
else
FileUtils.cp docs_path, target_docs_path
end
end
when docs_workflow_yaml
next if custom_docs_repos.include?(repository_name)
Expand Down Expand Up @@ -180,7 +188,7 @@ def git(*args)
#
# rubocop:disable Homebrew/NegateInclude
# We don't have Homebrew exclude? method here.
if !custom_ruby_version_repos.include?(repository_name) && (target_directory_path/"Gemfile.lock").exist?
if !custom_ruby_version_repos.include?(repository_name) && target_gemfile_lock.exist?
Dir.chdir target_directory_path do
require "bundler"
bundler_version = Bundler::Definition.build(homebrew_gemfile, homebrew_gemfile_lock, false)
Expand Down