Skip to content

Commit 722d5c2

Browse files
committed
build(deps): install the shared config from GitHub Packages instead of a git URL
Last consumer on "@max-health/config": "github:max-health-inc/config". That form carries no version range and no integrity entry, so the lockfile silently freezes one commit — here 2.4.0 at 47dec406, which happened to be current, but nothing recorded that and nothing would have surfaced it drifting. dry.codes was two majors behind the same way. Now "@max-health-inc/config": "^3.1.0" from GitHub Packages with an integrity hash. The package was RENAMED for this: GitHub Packages resolves an npm scope to the owner hosting it, so @max-health/* cannot be served from Max-Health-Inc at all. Content is unchanged from 2.4.0, so the tsconfig/eslint/vitest baselines this repo inherits are identical. Eleven specifier sites moved with the dep: tsconfig.json extends, eslint.config.mjs (eslint/rules), vitest.config.ts, vitest.parity.config.ts, and the vitest.config.ts in each of the six generated client packages. This repo needed more than a dep swap, unlike the other nine: - Added .npmrc. There was none, so @max-health-inc/* would have resolved against registry.npmjs.org and 404'd. Only that scope is redirected; everything else, including what this repo PUBLISHES to npmjs.org, is untouched. - Every `npm ci` needs a token, because npm.pkg.github.com requires one even for a public package. Set NODE_AUTH_TOKEN at workflow level in the seven workflows that do not publish, which covers all of them including the install inside packages/zod. - release.yml and _release.yml get it STEP-scoped instead. setup-node there writes //registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}, so a workflow-level value would be sent to npmjs.org by `npm publish --provenance` and would override OIDC trusted publishing. - pipeline-parity-{develop,main}.yml now pass `secrets: inherit` to _parity-tests.yml. A called workflow sees no secrets otherwise, and an unset secret expands to an EMPTY string that fails with a 401 indistinguishable from a bad token. bun.lock is gitignored here, so only package-lock.json is committed. tsc --noEmit clean, eslint clean, 773 tests pass (the one cliEntrypoint failure was a missing out/ from running vitest without pretest's rimraf; it passes after a build).
1 parent 13bd6a6 commit 722d5c2

22 files changed

Lines changed: 104 additions & 44 deletions

.github/workflows/_parity-tests.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ on:
2727
# In local dev, babelfhir-ts defaults to ~/.fhir/packages/ (shared with HL7 Validator).
2828
env:
2929
FHIR_CACHE_ROOT: .cache
30+
# @max-health-inc/config is installed from GitHub Packages (see .npmrc), which needs a
31+
# token even though the package is public. Set at workflow level so every `npm ci` in
32+
# every job below is covered, including the one that installs inside packages/zod.
33+
# Callers MUST pass `secrets: inherit` — a reusable workflow sees no secrets otherwise,
34+
# and an unset secret expands to an EMPTY string that fails with a 401 identical to a bad
35+
# token. Nothing here publishes, so a repo-wide NODE_AUTH_TOKEN is safe; the release
36+
# workflows scope theirs to the install step so it cannot reach `npm publish`.
37+
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
3038

3139
jobs:
3240
# ── Resolve validator versions ─────────────────────────────────────────────

.github/workflows/_release.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ jobs:
5050
registry-url: 'https://registry.npmjs.org'
5151

5252
- name: Install dependencies
53+
# Scoped to THIS step on purpose. setup-node above wrote
54+
# `//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}` into the project .npmrc, so a
55+
# workflow-level NODE_AUTH_TOKEN would be sent to npmjs.org by `npm publish` below —
56+
# a GitHub token is not valid there, and it would override the OIDC trusted publishing
57+
# this workflow relies on. Here it only authenticates the @max-health-inc scope in the
58+
# committed .npmrc (GitHub Packages needs a token even for a public package).
59+
env:
60+
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
5361
run: npm ci
5462

5563
- name: Update npm to latest (required for OIDC)

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ on:
66
pull_request:
77
branches: [develop, main]
88

9+
# @max-health-inc/config is installed from GitHub Packages (see .npmrc), which needs a token
10+
# even though the package is public. Set at workflow level so every `npm ci` below is covered.
11+
# An unset secret expands to an EMPTY string and fails with a 401 identical to a bad token.
12+
# Nothing in this workflow publishes, so a workflow-wide NODE_AUTH_TOKEN is safe here.
13+
env:
14+
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
15+
916
jobs:
1017
test:
1118
runs-on: ubuntu-latest

.github/workflows/deploy-docs.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ on:
1010
- 'package.json'
1111
workflow_dispatch:
1212

13+
# @max-health-inc/config is installed from GitHub Packages (see .npmrc), which needs a token
14+
# even though the package is public. Set at workflow level so every `npm ci` below is covered.
15+
# An unset secret expands to an EMPTY string and fails with a 401 identical to a bad token.
16+
# Nothing in this workflow publishes, so a workflow-wide NODE_AUTH_TOKEN is safe here.
17+
env:
18+
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
19+
1320
jobs:
1421
deploy-docs:
1522
runs-on: ubuntu-latest

.github/workflows/pipeline-parity-develop.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,20 @@ concurrency:
2323
group: parity-develop-${{ github.ref }}
2424
cancel-in-progress: false
2525

26+
# @max-health-inc/config is installed from GitHub Packages (see .npmrc), which needs a token
27+
# even though the package is public. Set at workflow level so every `npm ci` below is covered.
28+
# An unset secret expands to an EMPTY string and fails with a 401 identical to a bad token.
29+
# Nothing in this workflow publishes, so a workflow-wide NODE_AUTH_TOKEN is safe here.
30+
env:
31+
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
32+
2633
jobs:
2734
# ── Run both validators in parallel (reusable workflow) ────────────────────
2835
parity-tests:
2936
uses: ./.github/workflows/_parity-tests.yml
37+
# Required: the reusable workflow's `npm ci` needs GH_PACKAGES_TOKEN to fetch
38+
# @max-health-inc/config, and a called workflow sees NO secrets without this.
39+
secrets: inherit
3040
with:
3141
packages: ${{ github.event.inputs.packages || 'all' }}
3242
validator_version: ${{ github.event.inputs.validator_version || 'latest' }}

.github/workflows/pipeline-parity-main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,20 @@ on:
1919
required: false
2020
default: 'latest'
2121

22+
# @max-health-inc/config is installed from GitHub Packages (see .npmrc), which needs a token
23+
# even though the package is public. Set at workflow level so every `npm ci` below is covered.
24+
# An unset secret expands to an EMPTY string and fails with a 401 identical to a bad token.
25+
# Nothing in this workflow publishes, so a workflow-wide NODE_AUTH_TOKEN is safe here.
26+
env:
27+
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
28+
2229
jobs:
2330
# ── Run both validators in parallel (reusable workflow) ────────────────────
2431
parity-tests:
2532
uses: ./.github/workflows/_parity-tests.yml
33+
# Required: the reusable workflow's `npm ci` needs GH_PACKAGES_TOKEN to fetch
34+
# @max-health-inc/config, and a called workflow sees NO secrets without this.
35+
secrets: inherit
2636
with:
2737
packages: ${{ github.event.inputs.packages || 'all' }}
2838
validator_version: ${{ github.event.inputs.validator_version || 'latest' }}

.github/workflows/prerelease-develop.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ on:
66
- develop
77
workflow_dispatch:
88

9+
# @max-health-inc/config is installed from GitHub Packages (see .npmrc), which needs a token
10+
# even though the package is public. Set at workflow level so every `npm ci` below is covered.
11+
# An unset secret expands to an EMPTY string and fails with a 401 identical to a bad token.
12+
# Nothing in this workflow publishes, so a workflow-wide NODE_AUTH_TOKEN is safe here.
13+
env:
14+
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
15+
916
jobs:
1017
prerelease:
1118
runs-on: ubuntu-latest

.github/workflows/release.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ jobs:
5656
registry-url: 'https://registry.npmjs.org'
5757

5858
- name: Install dependencies
59+
# Scoped to THIS step on purpose. setup-node above wrote
60+
# `//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}` into the project .npmrc, so a
61+
# workflow-level NODE_AUTH_TOKEN would be sent to npmjs.org by `npm publish` below —
62+
# a GitHub token is not valid there, and it would override the OIDC trusted publishing
63+
# this workflow relies on. Here it only authenticates the @max-health-inc scope in the
64+
# committed .npmrc (GitHub Packages needs a token even for a public package).
65+
env:
66+
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
5967
run: npm ci
6068

6169
- name: Update npm to latest (required for OIDC)

.github/workflows/self-heal.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ permissions:
2525
contents: write
2626
actions: read
2727

28+
# @max-health-inc/config is installed from GitHub Packages (see .npmrc), which needs a token
29+
# even though the package is public. Set at workflow level so every `npm ci` below is covered.
30+
# An unset secret expands to an EMPTY string and fails with a 401 identical to a bad token.
31+
# Nothing in this workflow publishes, so a workflow-wide NODE_AUTH_TOKEN is safe here.
32+
env:
33+
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
34+
2835
jobs:
2936
self-heal:
3037
name: Auto-Fix Test Failures

.npmrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# @max-health-inc/config comes from the GitHub Packages npm registry, not npmjs.org. A
2+
# GitHub Packages scope resolves to the OWNER hosting it, so the scope must be mapped
3+
# explicitly — without this line npm resolves @max-health-inc/* against registry.npmjs.org
4+
# and 404s.
5+
#
6+
# npm substitutes ${NODE_AUTH_TOKEN} at install time, so no token is committed. CI supplies
7+
# it as GH_PACKAGES_TOKEN on every `npm ci` step; locally, `gh auth token` works. The
8+
# registry requires a token even though the package is PUBLIC.
9+
#
10+
# Everything else this repo installs, and everything it PUBLISHES (@babelfhir-ts/* ->
11+
# registry.npmjs.org, see _release.yml), is unaffected: only this one scope is redirected.
12+
@max-health-inc:registry=https://npm.pkg.github.com
13+
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}

0 commit comments

Comments
 (0)