From 960902229a4654186ad7a3c62d8ce5756e299467 Mon Sep 17 00:00:00 2001 From: Ankurjain1121 Date: Fri, 10 Apr 2026 00:10:54 +0200 Subject: [PATCH] feat: add npmrc_config input for enterprise npm registry configuration Add a new optional `npmrc_config` input that writes content to ~/.npmrc before the install step. This allows users in air-gapped or enterprise environments to configure private npm registries so bun install does not hang trying to reach registry.npmjs.org. Closes #1188 --- action.yml | 5 +++++ src/entrypoints/run.ts | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/action.yml b/action.yml index 2e3388c25..062db5026 100644 --- a/action.yml +++ b/action.yml @@ -142,6 +142,10 @@ inputs: description: "Show full JSON output from Claude Code. WARNING: This outputs ALL Claude messages including tool execution results which may contain secrets, API keys, or other sensitive information. These logs are publicly visible in GitHub Actions. Only enable for debugging in non-sensitive environments." required: false default: "false" + npmrc_config: + description: "Content to write to ~/.npmrc before installing dependencies. Useful for configuring private npm registries in air-gapped or enterprise environments." + required: false + default: "" plugins: description: "Newline-separated list of Claude Code plugin names to install (e.g., 'code-review@claude-code-plugins\nfeature-dev@claude-code-plugins')" required: false @@ -280,6 +284,7 @@ runs: INPUT_PATH_TO_BUN_EXECUTABLE: ${{ inputs.path_to_bun_executable }} INPUT_SHOW_FULL_OUTPUT: ${{ inputs.show_full_output }} DISPLAY_REPORT: ${{ inputs.display_report }} + INPUT_NPMRC_CONFIG: ${{ inputs.npmrc_config }} INPUT_PLUGINS: ${{ inputs.plugins }} INPUT_PLUGIN_MARKETPLACES: ${{ inputs.plugin_marketplaces }} PATH_TO_CLAUDE_CODE_EXECUTABLE: ${{ inputs.path_to_claude_code_executable }} diff --git a/src/entrypoints/run.ts b/src/entrypoints/run.ts index 4bfdddf14..30683dd73 100644 --- a/src/entrypoints/run.ts +++ b/src/entrypoints/run.ts @@ -219,6 +219,13 @@ async function run() { baseBranch = prepareResult.branchInfo.baseBranch; prepareCompleted = true; + // Write .npmrc if configured (for air-gapped / enterprise environments) + if (process.env.INPUT_NPMRC_CONFIG) { + const npmrcPath = `${process.env.HOME}/.npmrc`; + await appendFile(npmrcPath, `\n${process.env.INPUT_NPMRC_CONFIG}\n`); + console.log("Wrote custom .npmrc configuration"); + } + // Phase 2: Install Claude Code CLI await installClaudeCode();