尽管GitHub Actions似乎可以使用ssh-access进行工作,但仍无法通过SSH加载

问题描述

我正在执行一个github动作来在我的PR和push上运行测试,但是我无法确保测试能够访问我的私有存储库。

我已经在本地测试了我使用的SSH凭据,并且它们100%有效。

https://github.com/webfactory/ssh-agent

这是我正在使用的SSH代理。

这是我的github动作

# This workflow will do a clean install of node dependencies,build the source code and run tests across different versions of node
# For more @R_740_4045@ion see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
  push:
    branches: 
      - master
      - release/*
  pull_request:
    branches:
      - master
      - release/*

jobs:
  build:

    runs-on: ubuntu-latest

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

    steps:
    - uses: actions/checkout@v2
    - uses: webfactory/[email protected]
      with:
        ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - run: npm ci
    - run: npm run build --if-present
    - run: npm test

它似乎没有尝试利用它得到的SSH密钥

enter image description here

解决方法

由于https://github.com/Tixpire/tixpire-server似乎是私有的,因此您需要使用PAT (personal access token)来访问它。
另请参见actions/checkout issue 95

这是一个HTTPS URL,因此没有大量的SSH密钥将起作用:您需要一个SSH URL([email protected]:Tixpire/tixpire-server