Home > Mobile >  What do I need to do to clone a repo within the same org within a Github Actions workflow?
What do I need to do to clone a repo within the same org within a Github Actions workflow?

Time:09-20

Does anyone have experience with Github Actions? Within a Github Actions workflow, I am trying to clone another internal repo within the same org. I am doing the below.

- name: Install SSH Key
  uses: webfactory/[email protected]
  with:
        ssh-private-key: ${{ secrets.ACCESS_KEY }}

- name: Clone the internal repo
  uses: actions/checkout@v3
  with:
        repository: '[org name]/[repo name]'
        path: [my path]
        token: ${{ secrets.ACCESS_KEY }}

The Access_Key is a private key stored in the repo's secrets. The public part of the key is added to the internal repo (the repo I am trying to clone) as a deploy key.

The first step completes successfully, but it does log this:

Comment for (public) key ' ' does not match GitHub URL pattern. Not treating it as a GitHub deploy key.

The second step fails with this error:

token ... is not a legal HTTP header value

I'm not sure if the comment from the first step is causing a failure in the second or not. But I can't seem to fix either. Nor can I find really any documentation online to fix either of these. Does anyone have any ideas, advice, or experience with Github Actions, deploy keys, etc?

CodePudding user response:

  1. Create a new secret containing GitHub access token with read permissions to the target repository
  2. Use that token inside of your workflow (instead of GITHUB_TOKEN)
- uses: actions/checkout@v3
  with:
    repository: '[org name]/[repo name]'
    path: [my path]
    token: ${{ secrets.GITHUB_AUTH_TOKEN }}

Alternatively, you can add another repo as Git submodule to the main repo.

- uses: actions/checkout@v3
  with:
    submodules: '[submodules]'
  • Related