GitHub Packages Authentication
All our packages are hosted on the Allen Institute’s GitHub Packages registry. To use them, you will need to authenticate with GitHub Packages, which requires a GitHub account.
Setting Up Your Personal Access Token (PAT)
Section titled “Setting Up Your Personal Access Token (PAT)”Before you can install a package you’ll need to get your Personal Access Token (PAT) configured to have access.
-
Create a new personal access token (PAT) with the
read:packagesproper scope (read:packagesif you’re consumingvislibraries andwrite:packagesif you’re working on the repository code itself). You can create a new PAT by going to your GitHub settings, selecting “Developer settings” and then “Personal access tokens”. -
Make sure to copy the token to a safe place, as you won’t be able to see it again.
-
You’ll also need to Configure SSO for the Allen Institute organization for the token to work.
-
Add the PAT to the
~/.npmrcfile in your home directory. If you don’t have an~/.npmrcfile, create one. (This file is different from the.npmrcfiles in each repository, which get committed, so be sure you’re putting your token in the right place.) Add the following line to the file, replacingYOUR_PATwith the PAT you created in the previous step:
//npm.pkg.github.com/:_authToken=YOUR_PATAuthenticating in GitHub Actions or Another CI/CD Pipeline
Section titled “Authenticating in GitHub Actions or Another CI/CD Pipeline”If you have a CI/CD pipeline outside of GitHub Actions, do the following to authenticate:
-
Follow the instructions for generating a PAT in the previous section.
-
Add that new token to your pipeline’s secrets (e.g.
NODE_AUTH_TOKEN). -
Use that secret in your pipeline to set up the token before you do the package install:
npm set "//npm.pkg.github.com/:_authToken=$NODE_AUTH_TOKEN"Troubleshooting
Section titled “Troubleshooting”If any of the previous steps don’t work due to updates in GitHub’s platform, please reference GitHub’s documentation for details and submit a PR updating this documentation.