Today the GitHub PAT (personal access token) expired in one of my projects, I literally waked up to this:
(╯°□°)╯︵ ┻━┻
It happens that GitHub dropped the support to pass along the password to auth on private repos, which is part of my workflow, because I link npm dependencies with git+https
schema, in my package.json
.
💡
#3b3b3371d24b31d18bfef6296635df37f7131925
targets a specific commit.
Well for some reason this was not working anymore, that’s somewhat good, because I had my PAT hardcoded right there 🤠
»Let’s fix it!
The proper way to this, which also addresses the issue I’ve posted initially, is the following.
- First create a new PAT - ideally with minimum amount of scopes.
- Now you have your PAT you’ll have to make it accessible to whatever repo where you will use the token in its GitHub action. Add this to the repo secrets.
- Great, now my tricky work around. Because I can only install this via GitHub (limited infra available to manage packages), I add my target dependency under
optionalDependencies
rather thandependencies
in thepackage.json
. This means we will usenpm install --no-optional
in our CI in order to skip the dependency that needs auth to download the package from a private repo.
- Now in your GitHub action add the additional steps.
💡
MY_PAT_SECRET
needs to match the secret name you added in GitHub.
Hope this workaround helps you as it helped me!