diff --git a/.github/actions/sync/shared-config.rb b/.github/actions/sync/shared-config.rb index 51c57d53..a1cd15ce 100755 --- a/.github/actions/sync/shared-config.rb +++ b/.github/actions/sync/shared-config.rb @@ -24,10 +24,12 @@ def git(*args) abort "Usage: #{$PROGRAM_NAME} " end +docs = "docs" ruby_version = ".ruby-version" rubocop_yml = ".rubocop.yml" dependabot_yml = ".github/dependabot.yml" +homebrew_docs = homebrew_repository_path/docs homebrew_ruby_version = (homebrew_repository_path/"Library/Homebrew/vendor/portable-ruby-version").read .chomp @@ -57,16 +59,22 @@ def git(*args) puts "Detecting changes…" [ + docs, ruby_version, rubocop_yml, dependabot_yml, ".github/workflows/lock-threads.yml", ".github/workflows/stale-issues.yml", -].each do |file| - target_path = target_directory_path/file +].each do |path| + target_path = target_directory_path/path target_path.dirname.mkpath - case file + case path + when docs + next unless target_path.exist? + next unless target_path.directory? + + FileUtils.cp_r homebrew_docs, target_path when ruby_version next if custom_ruby_version_repos.include?(repository_name) @@ -83,13 +91,13 @@ def git(*args) ) when dependabot_yml next if custom_dependabot_repos.include?(repository_name) - next if file == target_path.to_s + next if path == target_path.to_s - FileUtils.cp file, target_path + FileUtils.cp path, target_path else - next if file == target_path.to_s + next if path == target_path.to_s - FileUtils.cp file, target_path + FileUtils.cp path, target_path end end