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

Further improve shared configuration syncing #112

Merged
merged 1 commit into from
May 24, 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
20 changes: 19 additions & 1 deletion .github/actions/sync/shared-config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def git(*args)

target_directory = ARGV[0]
target_directory_path = Pathname(target_directory)
repository_name = target_directory_path.basename.to_s
homebrew_repository_path = Pathname(ARGV[1])

if !target_directory_path.directory? || !homebrew_repository_path.directory? || ARGV[2]
Expand All @@ -25,6 +26,7 @@ def git(*args)

ruby_version = ".ruby-version"
rubocop_yml = ".rubocop.yml"
dependabot_yml = ".github/dependabot.yml"

homebrew_ruby_version =
(homebrew_repository_path/"Library/Homebrew/vendor/portable-ruby-version").read
Expand All @@ -35,13 +37,23 @@ def git(*args)
permitted_classes: [Symbol, Regexp],
)
homebrew_rubocop_config = homebrew_rubocop_config_yaml.reject do |key, _|
key.match?(%r{\Arequire|inherit_from|inherit_mode|Cask/|Formula|Homebrew/|Performance/|RSpec|Sorbet/})
key.match?(%r{\Arequire|inherit_from|inherit_mode|Cask/|Formula|Homebrew|Performance/|RSpec|Sorbet/})
end.to_yaml

custom_rubocop_repos = %w[
ci-orchestrator
orka_api_client
ruby-macho
].freeze
custom_dependabot_repos = %w[
brew
].freeze

puts "Detecting changes…"
[
ruby_version,
rubocop_yml,
dependabot_yml,
".github/workflows/lock-threads.yml",
".github/workflows/stale-issues.yml",
].each do |file|
Expand All @@ -52,7 +64,13 @@ def git(*args)
when ruby_version
target_path.write("#{homebrew_ruby_version}\n")
when rubocop_yml
next if custom_rubocop_repos.include?(repository_name)

target_path.write("#{homebrew_rubocop_config}\n")
when dependabot_yml
next if custom_dependabot_repos.include?(repository_name)

FileUtils.cp file, target_path
else
FileUtils.cp file, target_path
end
Expand Down
43 changes: 42 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,49 @@
# This file is synced from the `.github` repository, do not modify it directly.
version: 2

updates:

- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
allow:
- dependency-type: all
# The actions in triage-issues.yml are updated in the Homebrew/.github repo
ignore:
- dependency-name: actions/stale
- dependency-name: dessant/lock-threads

- package-ecosystem: bundler
directory: /
schedule:
interval: daily
allow:
- dependency-type: all

- package-ecosystem: npm
directory: /
schedule:
interval: daily
allow:
- dependency-type: all

- package-ecosystem: docker
directory: /
schedule:
interval: daily
allow:
- dependency-type: all

- package-ecosystem: devcontainers
directory: /
schedule:
interval: daily
allow:
- dependency-type: all

- package-ecosystem: pip
directory: /
schedule:
interval: daily
allow:
- dependency-type: all
Loading