Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ jobs:
# output and still never reaches the request, which fails as a 401 saying
# no authorization header was set.
- name: Authenticate to GitHub Packages
run: pnpm config set //npm.pkg.github.com/:_authToken "$NODE_AUTH_TOKEN"
run: |
if [ -z "$NODE_AUTH_TOKEN" ]; then
echo "::error::NODE_AUTH_TOKEN is empty. Set it with:" \
"gh secret set NODE_AUTH_TOKEN --repo ${{ github.repository }}" \
"(a GitHub token with read:packages)."
exit 1
fi
pnpm config set //npm.pkg.github.com/:_authToken "$NODE_AUTH_TOKEN"
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}

Expand Down Expand Up @@ -65,7 +72,14 @@ jobs:
# output and still never reaches the request, which fails as a 401 saying
# no authorization header was set.
- name: Authenticate to GitHub Packages
run: pnpm config set //npm.pkg.github.com/:_authToken "$NODE_AUTH_TOKEN"
run: |
if [ -z "$NODE_AUTH_TOKEN" ]; then
echo "::error::NODE_AUTH_TOKEN is empty. Set it with:" \
"gh secret set NODE_AUTH_TOKEN --repo ${{ github.repository }}" \
"(a GitHub token with read:packages)."
exit 1
fi
pnpm config set //npm.pkg.github.com/:_authToken "$NODE_AUTH_TOKEN"
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}

Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,23 @@ jobs:
node-version-file: ".nvmrc"
cache: "pnpm"

# @elirobinson/tokens comes from GitHub Packages, which the runner has no
# credential for by default. `pnpm config set`, not an echo into ~/.npmrc:
# pnpm 11 keeps its own credential store and only sends tokens from there.
# The length check is because an empty secret produces the same 401 as a
# missing one, and the registry error names neither the secret nor the repo.
- name: Authenticate to GitHub Packages
run: |
if [ -z "$NODE_AUTH_TOKEN" ]; then
echo "::error::NODE_AUTH_TOKEN is empty. Set it with:" \
"gh secret set NODE_AUTH_TOKEN --repo ${{ github.repository }}" \
"(a GitHub token with read:packages)."
exit 1
fi
pnpm config set //npm.pkg.github.com/:_authToken "$NODE_AUTH_TOKEN"
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}

- name: Install dependencies
run: pnpm install --frozen-lockfile

Expand Down