diff --git a/.github/bleeding_edge.rb b/.github/bleeding_edge.rb index d046e66f..fa3ff9b4 100644 --- a/.github/bleeding_edge.rb +++ b/.github/bleeding_edge.rb @@ -1,4 +1,5 @@ require "bundler" +require "json" remote = "https://rubygems.org" fetcher = Bundler::Fetcher.new(Bundler::Source::Rubygems::Remote.new(remote)) @@ -16,17 +17,18 @@ "nokogiri", # Unknown, mini_portile2 is not found during the build. Maybe platform-related. "mini_portile2", ].freeze +OVERRIDES = JSON.parse(ENV.fetch("GEM_OVERRIDES", "{}")) stubs.each do |stub| url = stub.metadata["source_code_uri"] || stub.homepage matched = url[%r{https?://git(?:hub|lab)\.com/[^\/]*/[^\/]*}] next if FULL_SKIP.include?(stub.name) - lines << if matched && !NO_GIT.include?(stub.name) # rubocop:disable Rails/NegateInclude - "gem #{stub.name.inspect}, git: #{matched.inspect}, submodules: true" - else - "gem #{stub.name.inspect}" - end + extra = {} + extra = { git: matched, submodules: true } if matched && !NO_GIT.include?(stub.name) # rubocop:disable Rails/NegateInclude + extra = OVERRIDES[stub.name] if OVERRIDES.key?(stub.name) + + lines << "gem #{stub.name.inspect}, #{extra.inspect}" end File.write("Gemfile", lines.join("\n")) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 0847a8e5..c23b6040 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -36,6 +36,8 @@ jobs: uses: ruby/setup-ruby@v1 - if: env.BLEEDING_EDGE == 'true' name: Use git gem sources + env: + GEM_OVERRIDES: ${{ vars.GEM_OVERRIDES }} # https://github.com/rubygems/rubygems/issues/8238 run: ruby .github/bleeding_edge.rb && bundle lock --update && cat Gemfile.lock