Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Private https repos in manifest.json #136

Closed
shubear opened this issue Jul 19, 2021 · 5 comments
Closed

Private https repos in manifest.json #136

shubear opened this issue Jul 19, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@shubear
Copy link

shubear commented Jul 19, 2021

I am trying to run unity tests after adding private repos to the manifest.json and the tests are failing with

 [Package Manager] Done resolving packages in 7.48s seconds
2021-07-19T03:10:19.0820219Z An error occurred while resolving packages:
2021-07-19T03:10:19.0821267Z   Project has invalid dependencies:
2021-07-19T03:10:19.0822847Z     com.companyname.somepackage: Error when executing git command. fatal: could not read Username for 'https://github.com': terminal prompts disabled
2021-07-19T03:10:19.0824444Z 
2021-07-19T03:10:19.0824936Z     You may need to set up a Git credentials helper
2021-07-19T03:10:19.0825527Z     to access a private repository.
2021-07-19T03:10:19.0826950Z     com.companyname.utility: Error when executing git command. fatal: could not read Username for 'https://github.com': terminal prompts disabled
2021-07-19T03:10:19.0827831Z 
2021-07-19T03:10:19.0828300Z     You may need to set up a Git credentials helper
2021-07-19T03:10:19.0828870Z     to access a private repository.
2021-07-19T03:10:19.0829209Z 
2021-07-19T03:10:19.0830234Z A re-import of the project may be required to fix the issue or a manual modification of /github/workspace/Packages/manifest.json file.

I didn't find anything relevant to the topic in this documentation.
Is there a known way to get this to work ?
I did try using githubToken: ${{ secrets.GITHUB_TOKEN }} and even tried it with a PAT, but the outcome was the same.

@shubear shubear added the bug Something isn't working label Jul 19, 2021
@shubear
Copy link
Author

shubear commented Jul 19, 2021

I even tried using SSH keys mentioned in this documentation, and it continues to fails

@shubear shubear changed the title Private repos in manifest.json Private https repos in manifest.json Jul 19, 2021
@shubear
Copy link
Author

shubear commented Jul 19, 2021

Update on the issue, i managed to get SSH to run by changing the manifest.json dependencies to use ssh ssh://git@github.com/
Previously it was https://github.com/
Is there a way for the actions to work with https ?

@GabLeRoux
Copy link
Member

GabLeRoux commented Jul 19, 2021

I haven't tested this, this is only a suggestion, but here's what I would try:

Since you still need authentication to happen when using https (for private repositories), you might need to find a way to execute the following in the container where git commands happen. I don't exactly know where and how to do it as part of github-actions

git config credential.helper '!f() { sleep 1; echo "username=${GIT_USER}"; echo "password=${GIT_PASSWORD}"; }; f'

This will configure git credentials using environment variables. ref: https://stackoverflow.com/a/43022442/1092815

To achieve this, it might be necessary to fork the game-ci/unity-test-runner action or the builder (depending on what you're trying to achieve) and inject this command before the test or build command happens.

It would also be preferable to use ${{ secrets.GITHUB_TOKEN }} instead of actual username/password credentials.

Also note that this is just a suggestion and a workaround. There is most likely a better way than that. Using ssh is indeed much easier than the above ;)

Here are some documentation concerning authentication in a workflow for github-actions and the GITHUB_TOKEN secret:
https://docs.github.com/en/actions/reference/authentication-in-a-workflow

@webbertakken
Copy link
Member

Perhaps you could also manipulate git config to use ssh in CI over https.

I recently saw a great example of how to do this.

@davidmfinol
Copy link
Member

davidmfinol commented Nov 4, 2021

Should be fixed by #152

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants