ReviewOS

also looking at this

pantry-pm/pantry

fix(action): normalize zig package name underscores to hyphens on publish

#206
Merged chrisbbreuer wants to merge fix/zig-action-name-normalization into main
2 files +311 -304
packages/action/src/index.tsmodified+8-1
Changes to packages/action/src/index.ts
@@ -954,8 +954,15 @@ async function publishZigPackage(registryUrl: string, token: string, cwd: string
954954 if (!nameMatch) throw new Error('Could not parse .name from build.zig.zon')
955955 if (!versionMatch) throw new Error('Could not parse .version from build.zig.zon')
956956
957 const name = nameMatch[1] || nameMatch[2] || nameMatch[3]
957 // Zig's `.name` field must be a valid enum literal, so packages use
958 // underscores (e.g. `.zig_tls`). The pantry registry's canonical package
959 // name uses hyphens (`zig-tls`) — normalize so Actions publish under the
960 // same name the registry/site lists instead of a parallel `_` namespace.
961 const rawName = nameMatch[1] || nameMatch[2] || nameMatch[3]
962 const name = rawName.replace(/_/g, '-')
958963 const version = versionMatch[1]
964 if (name !== rawName)
965 core.info(`Normalized package name ${rawName} -> ${name}`)
959966 core.info(`Package: ${name}@${version}`)
960967
961968 // Collect paths from build.zig.zon .paths field