derberg / manage-files-in-multiple-repositories

GitHub Action that introduces support for global workflows. Global workflows are the one you update in just one repo and they are automatically updated in other repositories.
MIT License
52 stars 18 forks source link

Problem cloning repositories on self hosted runners #16

Closed Tjitse-E closed 3 years ago

Tjitse-E commented 3 years ago

Describe the bug

I'm having problems with the Github authentication, the clone action doesn't work:

Started updating abcd.nl repo Cloning abcd.nl. Error: Action failed because of: Error: Cloning into '/home/runner/work/.github/.github/clones/abcd.nl'... fatal: could not read Username for 'https://github.com': No such device or address

I traced the problem back to https://github.com/steveukx/git-js/issues/594, altough there the issue was caused by actions/checkout@v1. I'm using actions/checkout@v2.

How to Reproduce

I'm using private repositories, so I cannot specify the steps to reproduce. Probably it has something to do with my self hosted runner setup.

Tjitse-E commented 3 years ago

@derberg what do you think of this solution? https://github.com/Tjitse-E/global-workflows-support/commit/65bcc73644877b8e9e94ad8e25026c18fd4c29a3. Using the github token to clone the repo via HTTPS works for me.

derberg commented 3 years ago

@Tjitse-E sounds good, I never thought about using it on private repos, but of course it makes sense 😄

Just solution should be provided in different place. The clone function should be extended with an additional token argument and the magic of creating authenticated URL should be in git.js in the function. I guess you could just move this https://github.com/Tjitse-E/global-workflows-support/blob/main/lib/git.js#L16-L19 to utils and reuse in these 2 functions

Tjitse-E commented 3 years ago

Ok, I will see if I have some time to create a PR for this in the coming days.

derberg commented 3 years ago

@Tjitse-E this is not supported with 0.3.0 https://github.com/derberg/global-workflows-support/releases/tag/v0.3.0