vegiv
vegiv

Reputation: 152

Access another repo in organization in github action

I have a github action yml file that runs in a repo in an organization, in this file I need information that is in another repo inside the same organization. How can I clone this repo inside the yml file, so I can access the information there? I have tried

- name: Checkout configs
      uses: actions/checkout@v3
      with:

        repository: org/configs
        token: ${{ secrets.GH_PAT }} 
        path: configs

Im not sure if this secrets.GH_PAT need to be created or if this is something stored in the org or repo. The error I get that it cant find the token. And if I change the token to: token: ${{ secrets.GH_PAT || github.token }} it cant find the repo.

Upvotes: 2

Views: 8198

Answers (2)

bprem kumar
bprem kumar

Reputation: 1

Here is missing the branch name ref.

- name: Checkout configs
      uses: actions/checkout@v3
      with:

        repository: org/configs
        ref: <branch name>
        token: ${{ secrets.GH_PAT }} 
        path: configs

Upvotes: -1

vegiv
vegiv

Reputation: 152

The answer was that a admin needed to create a token in the org.

- name: Checkout configs
      uses: actions/checkout@v3
      with:
        repository: org/configs
        token: ${{ secrets.TOKEN_CREATED_BY_ADMIN }}
        path: configs
        ref: master

Upvotes: 3

Related Questions