anthropics / anthropics/claude-code-action

feat: add input to configure npm registry for air-gapped / enterprise environments

Open Beginner friendly
#1,188 3 comments 3 reactions 0 assignees View on GitHub
area:installation enhancement feature-request p2
Dominant language
TypeScript
Stars
8.9k
Forks
2.1k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

## Problem

In enterprise or air-gapped environments where outbound internet access is blocked,
the `Install Dependencies` step hangs indefinitely because `bun install` cannot reach
`registry.npmjs.org` to download native binary packages (e.g. `@img/sharp-linux-x64`, `esbuild`).

The symptom is:
bun install v1.3.6
Clean lockfile: 192 packages - 192 packages in 321.6us
[PackageManager] waiting for 163 tasks
[PackageManager] waiting for 163 tasks
... (repeats until job timeout)

There is currently no action input to redirect `bun install` to an internal npm mirror
(Artifactory, Nexus, etc.).

## Current workaround

Users can add a pre-step to write `~/.npmrc` before the action runs, since bun reads it automatically:

- name: Configure npm registry
run: |
echo "registry=https://your-internal-artifactory/api/npm/npm-virtual/" >> ~/.npmrc
echo "//your-internal-artifactory/api/npm/npm-virtual/:_authToken=${{ secrets.TOKEN }}" >> ~/.npmrc

This works but requires knowing the internal implementation detail that the action uses bun and that bun reads `~/.npmrc`.

## Proposed solution

Add an action input (e.g. `npmrc_config`) that accepts a multiline string of `.npmrc`
content and writes it to `~/.npmrc` before the `Install Dependencies` step:

# action.yml
inputs:
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: ""

Usage:
- uses: anthropics/claude-code-action@v1
with:
npmrc_config: |
registry=https://your-internal-artifactory/api/npm/npm-virtual/
//your-internal-artifactory/api/npm/npm-virtual/:_authToken=${{ secrets.TOKEN }}
strict-ssl=false

## Why this matters

This is a blocker for teams running self-hosted runners in network-restricted environments —
a common enterprise setup where all dependencies must go through an approved internal proxy.

Happy to contribute a PR if the approach looks good to maintainers.

Contributor guide

Open the contributing guide

Research direction

Start in action.yml and trace the Install Dependencies step that runs bun install. Confirm how action inputs are declared and consumed, then verify that multiline npmrc_config content is written to ~/.npmrc before dependency installation and supports the documented registry and authentication example.

Written by the indexing model from the issue text.

Assessment

Tech stack
bun, github-actions
Domain
ci-cd
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.