Skip to content

Commit b2fdd80

Browse files
authored
Use pinned bun binary for post-steps when allowed_non_write_users is set (#1190)
Copies the bun binary into $GITHUB_ACTION_PATH/bin before the claude step runs and uses that copy in the two post-steps that invoke bun. Falls back to PATH-resolved bun when allowed_non_write_users is empty. :house: Remote-Dev: homespace
1 parent 26ddc35 commit b2fdd80

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

action.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,16 @@ runs:
223223
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
224224
fi
225225
226+
- name: Pin bun binary for post-steps
227+
if: ${{ inputs.allowed_non_write_users != '' }}
228+
continue-on-error: true
229+
shell: bash
230+
run: |
231+
# Keep a copy of the bun binary alongside the action's own files so
232+
# post-steps use the same version that was on PATH at action start.
233+
mkdir -p "$GITHUB_ACTION_PATH/bin"
234+
cp "$(command -v bun)" "$GITHUB_ACTION_PATH/bin/bun"
235+
226236
- name: Run Claude Code Action
227237
id: run
228238
shell: bash
@@ -336,7 +346,9 @@ runs:
336346
if: always() && inputs.ssh_signing_key != ''
337347
shell: bash
338348
run: |
339-
bun --no-env-file \
349+
BUN_BIN="${GITHUB_ACTION_PATH}/bin/bun"
350+
[ -x "$BUN_BIN" ] || BUN_BIN="bun"
351+
"$BUN_BIN" --no-env-file \
340352
--config="${GITHUB_ACTION_PATH}/bunfig.toml" \
341353
--tsconfig-override="${GITHUB_ACTION_PATH}/tsconfig.json" \
342354
run ${GITHUB_ACTION_PATH}/src/entrypoints/cleanup-ssh-signing.ts
@@ -351,7 +363,9 @@ runs:
351363
PR_NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }}
352364
ANTHROPIC_API_KEY: ${{ inputs.anthropic_api_key }}
353365
run: |
354-
bun --no-env-file \
366+
BUN_BIN="${GITHUB_ACTION_PATH}/bin/bun"
367+
[ -x "$BUN_BIN" ] || BUN_BIN="bun"
368+
"$BUN_BIN" --no-env-file \
355369
--config="${GITHUB_ACTION_PATH}/bunfig.toml" \
356370
--tsconfig-override="${GITHUB_ACTION_PATH}/tsconfig.json" \
357371
run ${GITHUB_ACTION_PATH}/src/entrypoints/post-buffered-inline-comments.ts

0 commit comments

Comments
 (0)