Open aliphys opened 3 months ago
Hi @aliphys. The token is only used for GitHub API requests. The operation that is failing is just a standard git clone
, which doesn't use the GitHub API at all.
I documented how to do this in the FAQ after the last time you reported it (https://github.com/arduino/compile-sketches/issues/167):
Alternatively, you could use a dedicated step in the workflow to checkout the private repository to the runner workspace prior to the step that runs the arduino/compile-sketches action. You would use the actions/checkout action in this step. actions/checkout has support specifically for checking out private repositories using a PAT:
https://github.com/actions/checkout#checkout-multiple-repos-private
Then instead of using a "repository" source for the private library dependency in the arduino/compile-sketches action step, you would use the "local path" source for the library dependency, which will now be possible since the actions/checkout step has placed it in the local path under the runner workspace.
Using actions/checkout might be superior to the source-url: https://<PAT>@<URL>
approach described in the FAQ since programmatically cloning private repositories with a PAT via actions/checkout is explicitly supported by GitHub, whereas I just did some searching and was not able to find any authoritative reference for git clone https://<PAT>@<URL>
(even though I'm sure I learned about this from the official GitHub documentation at some point in the past).
Describe the problem
GitHub Runner does not have access to private repositories, even when the
github-token
field is set.To reproduce
As part of a compile-examples workflow, I have a private repository that I want to include in the
libraries
field.As stated in the README section the token is provided to the GitHub API:
github-token: ${{ secrets.GITHUB_TOKEN }}
https://github.com/arduino/compile-sketches/blob/8ac27e99289705c4abec832089575d687b859227/README.md?plain=1#L210-L214However, the internal library is not accessible to the GitHub Runner according to the logs.
Expected behavior
If I enter a private GitHub repository for the
source-url
key, and I have access to it, then the GitHub Runner should also have access to it and load the library.'arduino/compile-sketches' version
arduino/compile-sketches@v1
Additional context
No response
Issue checklist