Skip to content

Commit 540dd8e

Browse files
committed
fix(actions/lib): drop @socketsecurity/lib-stable imports — runs pre-setup-node
ERR_MODULE_NOT_FOUND on every fleet CI run: Cannot find package '@socketsecurity/lib-stable' imported from /home/runner/work/_actions/SocketDev/socket-registry/<sha>/.github/actions/lib/install-tool.mjs Both .github/actions/lib/install-tool.mjs and .github/actions/lib/semver.mjs imported getDefaultLogger from @socketsecurity/lib-stable/logger, but they run during the SETUP action's pre-setup-node phase, when node_modules hasn't been populated yet. The header comments in the files already document this constraint — the imports were inconsistent with the file's own contract. Replace with a tiny inline logger that exposes only the .fail method these scripts use (single-line console.error wrapper). Annotated with oxlint-disable-next-line socket/no-console-prefer-logger explaining the bootstrap-step constraint. This was the actual root cause of the post-pnpm-bump CI red: every fleet runner's setup-and-install failed at the install-tool.mjs invocation, never got to install pnpm 11.1.3, and downstream steps complained about the runner's preinstalled pnpm 11.0.6. Pre-commit bypassed (SOCKET_API_KEY 401, user-authorized via 'Allow lint bypass').
1 parent d61dee9 commit 540dd8e

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

.github/actions/lib/install-tool.mjs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,19 @@ import {
3535
writeFileSync,
3636
} from 'node:fs'
3737
import path from 'node:path'
38-
import { getDefaultLogger } from '@socketsecurity/lib-stable/logger'
3938

40-
const logger = getDefaultLogger()
39+
// Composite-action helper runs on the raw runner BEFORE setup-node finishes
40+
// resolving node_modules — `@socketsecurity/lib-stable` is not on disk yet
41+
// (the comments in the oxlint-disable directives below already document this
42+
// constraint). Fall back to a tiny inline logger that mirrors the bits of
43+
// @socketsecurity/lib-stable/logger that this script uses (just `.fail` for
44+
// the usage line). Switching back to the lib logger would require pre-
45+
// installing it, which defeats the whole point of this being a bootstrap
46+
// step.
47+
const logger = {
48+
// oxlint-disable-next-line socket/no-console-prefer-logger -- pre-setup-node action; @socketsecurity/lib-stable not installed yet.
49+
fail: msg => console.error(msg),
50+
}
4151

4252
const [, , url, integrityArg, destDir, binName] = process.argv
4353

.github/actions/lib/semver.mjs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
import { getDefaultLogger } from '@socketsecurity/lib-stable/logger'
2-
const logger = getDefaultLogger()
1+
// Composite-action helper runs on the raw runner BEFORE setup-node finishes
2+
// resolving node_modules — `@socketsecurity/lib-stable` is not on disk yet.
3+
// Use a tiny inline logger that mirrors the `.fail` API this script needs.
4+
const logger = {
5+
// oxlint-disable-next-line socket/no-console-prefer-logger -- pre-setup-node action; @socketsecurity/lib-stable not installed yet.
6+
fail: msg => console.error(msg),
7+
}
38

49
/**
510
* @file Semver validate + compare for composite-action shells. Replaces inline

0 commit comments

Comments
 (0)