我想priv_gem_a
通过 github 操作在 gem 上运行 rspec(调用它)。
priv_gem_a
取决于私人回购中的另一个宝石(称之为priv_gem_b
)。priv_gem_b
但是,由于权限无效,我无法捆绑安装。
错误:
Fetching gem metadata from https://rubygems.org/..........
Fetching git@github.com:myorg/priv_gem_b
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Host key verification failed.
Retrying `git clone 'git@github.com:myorg/priv_gem_b' "/opt/hostedtoolcache/Ruby/2.6.3/x64/lib/ruby/gems/2.6.0/cache/bundler/git/priv_gem_b-886cdb130fe04681e92ab5365f7a1c690be8e62b" --bare --no-hardlinks --quiet` due to error (2/4): Bundler::Source::Git::GitCommandError Git error: command `git clone 'git@github.com:myorg/priv_gem_b' "/opt/hostedtoolcache/Ruby/2.6.3/x64/lib/ruby/gems/2.6.0/cache/bundler/git/priv_gem_b-886cdb130fe04681e92ab5365f7a1c690be8e62b" --bare --no-hardlinks --quiet` in directory /home/runner/work/priv_gem_a/priv_gem_a has failed.
我认为这与跑步者无法访问同一组织中的不同私人仓库有关。
所以我尝试将环境变量添加到我的工作流文件中,包括GITHUB_TOKEN
s,但这不起作用:
name: Test Code
on:
push:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Ruby 2.6
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Install dependencies
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUNDLE_GITHUB__COM: ${{ secrets.GITHUB_TOKEN }}:x-oauth-basic
run: |
gem install bundler
gem update bundler
bundle install --without development --jobs 4 --retry 3
- name: Test with RSpec
run: |
bundle exec rspec
只是 Gemfile 中关于此的一个片段:
gem 'priv_gem_b', '>= 7.0.1', '< 8', git: 'git@github.com:my_org/priv_gem_b', branch: :master