Skip to content

Commit

Permalink
Further improve shared configuration syncing
Browse files Browse the repository at this point in the history
- Also sync a decent, default, comprehensive Dependabot configuration
- Allow opt-out for custom RuboCop and Dependabot configurations
  • Loading branch information
MikeMcQuaid committed May 24, 2024
1 parent 5a9f3f5 commit 8d5f61e
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 2 deletions.
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

0 comments on commit 8d5f61e

Please sign in to comment.