github actions中checkout submodules (私有仓库)

212 阅读1分钟
jobs:
  # This workflow contains a single job called "build"
  deploy:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
    # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
    - name:  checkout
      uses: actions/checkout@v4
      with:
        submodules: 'true'
        ssh-key: ${{secrets.PRIVATE_KEY}} # 这个key,要配置你本地的.ssh/id_ed25519的内容。你的账号能checkout这个submodules,
        相当于要把私钥配置上去。

除了这个ssh-key,还有一个token字段,可以配置PAT,具体没有去验证了。反正这个问题,卡了我半天。