GITHUB_TOKEN does not have access to other private packages
Based on the documentation, I have my workflow set up to install from my GitHub Package Registry:
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 10.x
registry-url: 'https://npm.pkg.github.com'
- run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
However, I get a 404 when trying to install any private packages scoped to my account with this configuration. Just to clarify these are private packages within the same account that this repo and workflow exists.
Using the exact same configuration, if I replace with a personal access token I've created, I am able to install private packages without issue.
@Phanatic any idea why this would work with a PAT but not the GITHUB_TOKEN?
hmm, @Ignigena are the private packages hosted in the same repository as the workflow or are they in another repository under the same account?
The private packages are in another repository under the same account. Both have been published to GPR but as private packages.
Ahh, that's what I figured. The GITHUB_TOKEN we generate is scoped to the repository that is running the Workflow. Unfortunately, this doesn't allow us to install or publish packages from/to other repositories. I'll bring this up in planning and we can figure out how to proceed here.
I figured that might be the case. Would love a solution at least for installing within the same organization. Would rather not have to create a personal access token for each repository -- we're using private NPM modules quite a bit to share business logic/components between all our repos.
We're already forced to do this with NPM's package registry and our TravisCI builds, but was hoping to avoid with Actions and GPR if we can. Totally understand there are probably other implications here, but keep us updated -- would love for this to be as seamless as publishing to GPR is now via an Action 🙂
This is a huge issue, almost impossible to use Actions CI for us now (without that SSH key fiddling we use now for CircleCI). @Phanatic please keep us posted – token working across the whole organization is a must.
@Phanatic, any update on this?
This is indeed a big issue and makes working with the Package Registry much harder. It is very inconvenient having to distribute a personal access token that must be set as a secret on each repository. Please give the GITHUB_TOKEN read permissions to all registries in the same organization.
As of today, it now works. See #53
No, it isn't fixed. #53 is about publishing a package, which can be done. This is about pulling packages from other private repos, which can't be done, it requires a personal access token.
This is also a big issue for me and my company. There should be a way to have an org token that gives read access to the org's packages. Or give GITHUB_TOKEN to other packages of the same org
This is about pulling packages from other private repos, which can't be done, it requires a personal access token.
A PAT is the solution for other private repos.
This also isn't an issue with setting up node (this repo).
If you have a request for the service to expand the scope of the token, please leave feedback on community
https://github.community/
Thanks!
I posted a follow up issue to reproduce a similar "Error: 404 Not Found" bug on https://github.community/t5/GitHub-Actions/Package-not-found-in-the-Github-Registry/m-p/31685/highlight/false#M864
What repository do we post GPR related issues like the one i just mentioned above?
I believe github.community is the right place (unless it is actually related to setup-node action in this repo).
Why is this closed, this is a bug
@bryanmacfarlane a PAT is "personal" and can't be scoped to a single org, means a PAT has access to all my packages across all my orgs. That's not a solution to me. The GITHUB_TOKEN should have package:read access to all packages in the same org.
Here's another community thread related to this issue. As of today there's still no solution, only the (unsuitable) Personal Access Token workaround.
@wpitallo - this is closed here because there's nothing that this repo or the code in this repo can do to implement that feature. This is an individual action. Service issues and feature requests are tracked in GitHub community.
@PatrickHeneise package:read won't help here since actions are not packages. They are pulled and run from a repo at the ref specified. Per above there's feature work proposed on the backlog to allow actions to be able to published as packages and other service feature work to control scope of the token (the current behavior is defined as the repo triggering the workflow).
Agreed, the PAT option is a workaround and not a solution.
Hope that helps clarify.
Thanks, hope that is implemented soon. We removed our "GitHub service user" when we removed 3rd party CI and build services. Unbelievable that I need to create and pay for a service user again just to have org-level access to packages within the GitHub platform.
Having the same issue myself:
- we have 2 private repos under one org that are published as npm packages in the GPR.
- One of them has as a depencency the other one.
- If you try to run
npm ifrom a github action in the one that fetches the other private module, it saysnpm package "[...]" does not exist under owner "[...]", which is not true, and responds with a 404 error.
Certainly, adding a PAT solved the issue... But having as PAT the secrets.GITHUB_TOKEN should be enough! As it is to npm publish.
I think this is a similar situation as the one described by @Alappin.