[Organization] Install private repository A from private repository B

I have two private repositories in the same organization, say repository A and B, both of which are python packages. I have a “github workflow action” to test repository B for each PR, however repository B depends on repository A, so I would need to install it.

I think I can do that with some secret key but I’m very confused how.

How do I go about implementing this installation?

Do you need to clone repository A when the workflow run in repository B?
If so you could clone the repo A to an empty folder in repo B. In my example, I cloned another repo named “private” to the dist folder (include an useless test.txt file ) in the current repo using a personal access token.
Remember to add persist-credentials: false in the first checkout step.

name: clone another repo
on: push

    runs-on: ubuntu-latest
    - name: checkout current repo
      uses: actions/checkout@v2
        persist-credentials: false
    - name: checkout another private repo
      uses: actions/checkout@v2
        repository:  zhuorg/private
        token: ${{secrets. PAT}}
        path: dist

If you are in different scenario from mine, please provide some detail explanation of yours.

1 Like

Thank you very much for your help. I was hoping there was a PAT for organizations, but apparently the closest way to do that is to create a “machine user”, add it to the organization, generate a PAT from its account, and add it to organization secrets.

Thank you again, your snippet was also very useful!