npm install private github repo github actions

The*_*mis 1 git github node.js npm github-actions

I have a nodejs project that uses a private git repo as one of it's dependencies. It's defined in package.json like this:

"repo name": "git+https://{access_token}@github.com/{owner}/{repo name}.git#master"

My workflow file looks like this:

name: Tests

on: [push]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v3
        with:
          node-version: 16
      - name: Install modules
        run: npm ci
      - name: Run tests
        run: npm test
Run Code Online (Sandbox Code Playgroud)

npm ci however fails with npm ERR! remote: Repository not found.

Using npm ci on my local machine and on a clean ubuntu test machine works perfectly when I test it. I can't figure out what's causing this issue when on github actions.

I've read through many other forms but can't find any solution that works or is applicable to my situation. If you have any ideas as to what may be causing this I'd be happy to hear your leads.

ret*_*hab 7

来自的身份验证令牌actions/checkout将被保留。因此,从 GitHub 获取 npm 依赖项时可能会再次使用它,但这是行不通的。

您可以通过传递输入来选择退出,persist-credentials如下所示:

steps:
  - uses: actions/checkout@v2
    with:
      persist-credentials: false
Run Code Online (Sandbox Code Playgroud)