Authentication is required for rubygems.pkg.github.com

We have a private gem’s source that is configured with either:
bundle config gems.myprivatesource.com user:pass
OR with the ENV
BUNDLE_RUBYGEMS__PKG__GITHUB__COM: user:pass

When using bundle exec jets deploy locally it does not seem to copy the already downloaded gem because ruby_packager is using a fixed “bundled_gems” folder. Not much of a problem, since it downloads everything again and the deployment process can continue.

However, I am facing issues when running at GitHub Action.
Jets::Builders::RubyPackager.bundle_install creates a .bundle/config file without my private gems configuration. Moreover, it is running bundle with with_unbundled_env so my ENV does not work either. Since the ENVs are ignored and the config file does not include the required line for the private gems, the process fails with: Authentication is required for rubygems.pkg.github.com

Is anyone facing similar issues?
Any ideas on how to overcome it?

@roque86 I’m sure you already solved this but I’m adding this here for posterity. I had to configure the github action with the following to grant global access to credentials. I had to use a personal access token instead of the GITHUB_TOKEN

- name: Set Up Credentials For Access to Github Packages
  run: |
    bundle config set --global rubygems.pkg.github.com $GH_USERNAME:$GH_PACKAGES_TOKEN

Additionally the gem needs to be set up in the Gemfile in the following way:

source 'https://rubygems.pkg.github.com/my-user' do
  gem 'my_gem'
end
1 Like