@rightkit/ci 0.3.6 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/manifest.mjs +13 -2
  2. package/package.json +5 -6
package/manifest.mjs CHANGED
@@ -2202,7 +2202,8 @@ const CLASS_A_TOOL_STEPS = Object.freeze([
2202
2202
  " esac",
2203
2203
  " archive=\"$RUNNER_TEMP/actionlint-$asset\"",
2204
2204
  " curl --fail --silent --show-error --location --output \"$archive\" \"https://github.com/rhysd/actionlint/releases/download/v$ACTIONLINT_VERSION/actionlint_\"\"$ACTIONLINT_VERSION\"\"_$asset\"",
2205
- " actual=\"$( (sha256sum \"$archive\" 2>/dev/null || shasum -a 256 \"$archive\") | cut -d' ' -f1)\"",
2205
+ // Hash from stdin: GNU sha256sum escapes a path with backslashes (every Windows $RUNNER_TEMP) and prefixes the line with "\".
2206
+ " actual=\"$( (sha256sum < \"$archive\" 2>/dev/null || shasum -a 256 < \"$archive\") | cut -d' ' -f1)\"",
2206
2207
  " [ \"$actual\" = \"$sum\" ] || { echo \"::error::actionlint archive checksum mismatch\"; exit 1; }",
2207
2208
  " mkdir -p \"$RUNNER_TEMP/actionlint-bin\"",
2208
2209
  " case \"$asset\" in *.zip) unzip -o -q \"$archive\" actionlint.exe -d \"$RUNNER_TEMP/actionlint-bin\" ;; *) tar -xzf \"$archive\" -C \"$RUNNER_TEMP/actionlint-bin\" actionlint ;; esac",
@@ -2213,6 +2214,8 @@ const CLASS_A_TOOL_STEPS = Object.freeze([
2213
2214
  " shell: bash",
2214
2215
  " run: |",
2215
2216
  " set -euo pipefail",
2217
+ // The gate's Mac default root is on /Volumes/D, which a hosted runner has not got: this run's gate steps keep their state in the runner's temp.
2218
+ " if [ \"$RUNNER_OS\" = macOS ]; then export RIGHTKIT_DATA_ROOT=\"$RUNNER_TEMP/rightkit-data\"; echo \"RIGHTKIT_DATA_ROOT=$RIGHTKIT_DATA_ROOT\" >> \"$GITHUB_ENV\"; fi",
2216
2219
  " rk=node_modules/@rightkit/release",
2217
2220
  " [ -f \"$rk/scan-tool-enrolment.mjs\" ] || exit 0",
2218
2221
  " root=\"$(node --input-type=module -e \"import { resolveManagedRoots } from './$rk/managed-roots.mjs'; console.log(resolveManagedRoots().gateRoot)\")\"",
@@ -2220,7 +2223,7 @@ const CLASS_A_TOOL_STEPS = Object.freeze([
2220
2223
  " tool=\"${spec%@*}\"; bin=\"$(command -v \"$tool\")\"",
2221
2224
  // Git Bash on Windows names the file without .exe and as /c/...: the gate spawns the Windows path of the real file.
2222
2225
  " if command -v cygpath >/dev/null; then [ -f \"$bin.exe\" ] && bin=\"$bin.exe\"; bin=\"$(cygpath -w \"$bin\")\"; fi",
2223
- " sum=\"$( (sha256sum \"$bin\" 2>/dev/null || shasum -a 256 \"$bin\") | cut -d' ' -f1)\"",
2226
+ " sum=\"$( (sha256sum < \"$bin\" 2>/dev/null || shasum -a 256 < \"$bin\") | cut -d' ' -f1)\"",
2224
2227
  " node \"$rk/scan-tool-enrolment.mjs\" enroll --data-root \"$root\" --tool \"$tool\" --path \"$bin\" --sha256 \"$sum\" --version \"${spec#*@}\"",
2225
2228
  " done",
2226
2229
  ]);
@@ -2269,6 +2272,14 @@ export function checkJob(manifest, lane = "ci") {
2269
2272
  // Depth 2: the gate's lint-waiver-added rule (G30) compares a commit already on main with its first parent (rightkit#1865).
2270
2273
  " fetch-depth: 2",
2271
2274
  " persist-credentials: false",
2275
+ // A pull request checkout holds the merge commit and its parents, and no branch ref. The gate's merge-base rules need
2276
+ // the default branch as a remote ref: the merge commit's first parent is the base the pull request merges into.
2277
+ ...(lane === "ci" ? [
2278
+ " - name: Name the pull request base for the gate's merge-base rules",
2279
+ " if: github.event_name == 'pull_request'",
2280
+ " shell: bash",
2281
+ ` run: git update-ref "refs/remotes/origin/${manifest.defaultBranch ?? "main"}" "$(git rev-parse --verify 'HEAD^1^{commit}')"`,
2282
+ ] : []),
2272
2283
  ` - uses: ${pins.setupNode}`,
2273
2284
  " with:",
2274
2285
  ` node-version: ${JSON.stringify(String(manifest.matrix.node[0]))}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rightkit/ci",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "description": "Public-repo-only GitHub Actions workflow layer: templates, visibility gate, sync/drift/adopt/uninstall for right-git.",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "type": "module",
@@ -25,9 +25,6 @@
25
25
  "!*.test.mjs"
26
26
  ],
27
27
  "sideEffects": false,
28
- "scripts": {
29
- "test": "node --test pack-smoke.test.mjs"
30
- },
31
28
  "publishConfig": {
32
29
  "registry": "https://registry.npmjs.org/",
33
30
  "access": "public"
@@ -37,5 +34,7 @@
37
34
  "url": "git+https://github.com/bogusyogi/rightkit.git",
38
35
  "directory": "packages/ci"
39
36
  },
40
- "packageManager": "pnpm@12.16.1"
41
- }
37
+ "scripts": {
38
+ "test": "node --test pack-smoke.test.mjs"
39
+ }
40
+ }