Skip to content

Commit

Permalink
sync/shared-config: sync docs folder.
Browse files Browse the repository at this point in the history
This should allow us to enforce a consistent structure for documentation
across all our repositories.
  • Loading branch information
MikeMcQuaid committed Jun 6, 2024
1 parent a95c7ce commit 7fb2ba8
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions .github/actions/sync/shared-config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ def git(*args)
abort "Usage: #{$PROGRAM_NAME} <target_directory_path> <homebrew_repository_path>"
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
Expand Down Expand Up @@ -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)

Expand All @@ -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

Expand Down

0 comments on commit 7fb2ba8

Please sign in to comment.