1

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 nor 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.

vegiv
  • 124
  • 1
  • 9
  • you should refer to the linked doc https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets about how to creating the token and how to configure the token in the repo settings – Matteo Aug 04 '22 at 07:26
  • 1
    Does this answer your question? [Cloning private github repository within organisation in actions](https://stackoverflow.com/questions/57612428/cloning-private-github-repository-within-organisation-in-actions) – rethab Aug 04 '22 at 07:26

2 Answers2

1

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
vegiv
  • 124
  • 1
  • 9
0

Here 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
    
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 11 '22 at 11:23