Github actions with `github` protocol in `npm ci`

Viewed 49

Here's my node.js.yml:

name: Node.js CI

on:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [12.x, 14.x, 16.x]

    steps:
    - uses: actions/checkout@v3
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v3
      with:
        node-version: ${{ matrix.node-version }}
        cache: 'npm'
    - run: npm ci
    - run: npm test

In my package.json I have a dependency on uWebSockets.js as following:

  "dependencies": {
    // (...)
    "uWebSockets.js": "github:uNetworking/uWebSockets.js#v20.10.0",
    // (...)
  }

Now when the github action runs, on npm ci step I get the following output:

Run npm ci
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://git@github.com/uNetworking/uWebSockets.js.git
npm ERR! 
npm ERR! Warning: Permanently added the ECDSA host key for IP address '140.82.112.3' to the list of known hosts.
npm ERR! git@github.com: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR! 
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR! 
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2022-08-12T11_55_19_355Z-debug.log
Error: Process completed with exit code 1.

I have no clue what to change to make it work. Removing github: protocol explicit definition in package.json makes the library not install correctly in non-CI environment.

Thanks

0 Answers
Related