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

actions/sync/shared-config: further improve docs rubocop sync. #173

Merged
merged 1 commit into from
Aug 23, 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
17 changes: 13 additions & 4 deletions .github/actions/sync/shared-config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ def git(*args)
homebrew_rubocop_config = homebrew_rubocop_config_yaml.reject do |key, _|
key.match?(%r{\Arequire|inherit_from|inherit_mode|Cask/|Formula|Homebrew|Performance/|RSpec|Sorbet/})
end.to_yaml
homebrew_docs_rubocop_config_yaml = YAML.load_file(
homebrew_repository_path/"docs/#{rubocop_yaml}",
permitted_classes: [Symbol, Regexp],
)
homebrew_docs_rubocop_config = homebrew_docs_rubocop_config_yaml.reject do |key, _|
key.match?(%r{\AFormulaAudit/|Sorbet/})
end.to_yaml
.sub('inherit_from: "../Library/.rubocop.yml"', 'inherit_from: "../.rubocop.yml"')
homebrew_docs_workflow_yaml = homebrew_repository_path/docs_workflow_yaml
homebrew_vale_ini = homebrew_repository_path/vale_ini

Expand Down Expand Up @@ -140,10 +148,11 @@ def git(*args)
FileUtils.ln_s "../#{docs_path_basename}", "."
end
elsif docs_path_basename == ".rubocop.yml"
docs_rubocop = docs_path.read
.sub("inherit_from: ../Library/.rubocop.yml",
"inherit_from: ../.rubocop.yml")
target_docs_path.write(docs_rubocop)
FileUtils.rm_f target_docs_path
target_docs_path.write(
"# This file is synced from `Homebrew/brew` by the `.github` repository, do not modify it directly.\n" \
"#{homebrew_docs_rubocop_config}\n",
)
else
FileUtils.cp docs_path, target_docs_path
end
Expand Down