Skip to content

cpSync crashes with ENOENT when sensitive paths are symlinks #1187

@matanbaruch

Description

@matanbaruch

Bug

Since v1.0.89, the action crashes during restoreConfigFromBase when any of the SENSITIVE_PATHS (e.g. CLAUDE.md) is a symlink:

Restoring .claude, .mcp.json, .claude.json, .gitmodules, .ripgreprc, CLAUDE.md, CLAUDE.local.md, .husky from origin/main (PR head is untrusted)
ENOENT: no such file or directory, symlink

Cause

cpSync in restore-config.ts defaults to dereference: false, so it tries to recreate the symlink at .claude-pr/ rather than copying the file contents. This fails because the parent directory doesn't exist yet when symlink() is called.

Introduced in #1174.

Reproduction

  1. Have a repo where CLAUDE.md is a symlink (e.g. CLAUDE.md -> AGENTS.md)
  2. Open a PR and trigger claude-code-action@v1
  3. Action crashes with ENOENT: no such file or directory, symlink

Workaround

Pin to v1.0.88:

- uses: anthropics/claude-code-action@v1.0.88

Fix

#1186

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp2Non-showstopper bug or popular feature request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions