Skip to content

Commit e12d17d

Browse files
authored
chore: remove PAT based download (#8)
1 parent 8e35ab6 commit e12d17d

1 file changed

Lines changed: 60 additions & 7 deletions

File tree

README.md

Lines changed: 60 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,18 +161,71 @@ A few things worth knowing:
161161
Skills install like any other npm dependency, so your existing
162162
`npm` / `npx` / `npm update` flow manages them — upgrades included.
163163

164-
**1. One-time setup.** Point the `@bcgov` scope at GitHub Packages by adding an
165-
`.npmrc` next to your agent's `package.json`:
164+
**1. Point the `@bcgov` scope at GitHub Packages** by adding an `.npmrc` next to
165+
your agent's `package.json`:
166166

167167
```ini
168168
@bcgov:registry=https://npm.pkg.github.com
169-
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
169+
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}
170170
```
171171

172-
Your `GITHUB_TOKEN` needs the `read:packages` scope. (If the catalogue ever moves
173-
to the public npm registry, this step goes away.)
172+
`${NODE_AUTH_TOKEN}` is read from the environment at install time, so the token
173+
itself never lands on disk or in version control.
174174

175-
**2. Install** — pin a version for reproducible pulls:
175+
**2. Provide the token.** GitHub Packages requires authentication even for
176+
public packages, so `NODE_AUTH_TOKEN` needs to be set with a credential that has
177+
the `read:packages` scope. Pick whichever fits where the install runs:
178+
179+
- **Local development — use the [GitHub CLI](https://cli.github.com/).** No PAT
180+
to create, store, or rotate; the CLI already manages a token for you.
181+
182+
*Prerequisite:* install and sign in to the GitHub CLI once
183+
([install guide](https://github.com/cli/cli#installation)). On Windows:
184+
`winget install --id GitHub.cli`. On macOS: `brew install gh`. Then
185+
`gh auth login` to sign in. Verify with `gh auth status`.
186+
187+
One-time, add the `read:packages` scope to the CLI's token:
188+
189+
```bash
190+
gh auth refresh -h github.com -s read:packages
191+
```
192+
193+
Then, in each shell session you install from:
194+
195+
```powershell
196+
# PowerShell
197+
$env:NODE_AUTH_TOKEN = gh auth token
198+
```
199+
200+
```bash
201+
# bash / zsh
202+
export NODE_AUTH_TOKEN=$(gh auth token)
203+
```
204+
205+
`gh auth logout` revokes npm access at the same time — credential management
206+
stays in one place.
207+
208+
- **GitHub Actions (consuming workflow) — use the built-in `GITHUB_TOKEN`.** No
209+
secret to configure:
210+
211+
```yaml
212+
jobs:
213+
install-skills:
214+
runs-on: ubuntu-24.04
215+
permissions:
216+
contents: read
217+
packages: read
218+
steps:
219+
- uses: actions/checkout@v6
220+
- uses: actions/setup-node@v6
221+
with:
222+
node-version: "24"
223+
- run: npm ci
224+
env:
225+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
226+
```
227+
228+
**3. Install** — pin a version for reproducible pulls:
176229
177230
```bash
178231
npm install @bcgov/skill-<name>@0.1.0
@@ -183,7 +236,7 @@ else the skill ships, exactly as it lives in this repo. Point your agent's skill
183236
loader at that directory — the on-disk layout is preserved, so there's no extra
184237
wiring.
185238

186-
**3. Upgrade** — because skills are plain npm packages:
239+
**4. Upgrade** — because skills are plain npm packages:
187240

188241
```bash
189242
npm outdated @bcgov/skill-<name> # see what's newer

0 commit comments

Comments
 (0)