Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 5

Best way to clone a private repo during script run of private Github Action

I am writing a GitHub action within a private repo (./github-actions/my-action/entrypoint.sh). For reasons I need to clone a different private repo from with my org during the docker container's run of that script:

 

git clone "https://$GITHUB_TOKEN@github.com/myorg/other-private-repo.git" /other-private-repo

 

This does not work as the token the action is running with does not have access to that repo. I guess I could create a "machine" account, provide access to other-private-repo, and use that account's token as a secret. I'm just wondering if there is a more elegant way here...

4 Replies
Community Manager
Message 2 of 5

Re: Best way to clone a private repo during script run of private Github Action

Hi @agibralter,

 

Thanks for being here! I can't think of any obvious way to significantly improve your method. Will keep digging and post any updates here.

 

Best

Thanks for being here, sharing, and keeping our community awesome!
Best,
AndreaG

Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!

Copilot Lvl 2
Message 3 of 5

Re: Best way to clone a private repo during script run of private Github Action

@agibralter im trying to do the same, did you find any good solution for this you could share with the world :) 

Copilot Lvl 2
Message 4 of 5

Re: Best way to clone a private repo during script run of private Github Action

We went with the "machine account" method. Created a user with its own set of credentials that we added as GitHub Action secrets.

Copilot Lvl 2
Message 5 of 5

Re: Best way to clone a private repo during script run of private Github Action

thanks man, well seems like we will also have to stay with that solution as well