Skip to content

Conversation

@dionlow
Copy link
Contributor

@dionlow dionlow commented Dec 16, 2025

Summary

  • Fixes npm publish failure for scoped package @amp-labs/react
  • Adds --access public flag to the publish command in the GitHub Actions workflow
  • Bumps version to 2.9.12

Problem

The npm publish workflow was failing with error:

error Couldn't publish package: "https://registry.npmjs.org/@amp-labs%2freact: Not found"

This occurs when publishing scoped packages (packages with @ prefix) without explicit access permission. Without the --access public flag, npm assumes the package should be private, which requires a paid npm account.

Solution

Added --access public flag to the yarn publish command in .github/workflows/npm-publish.yml:46

Test plan

  • Local dry-run successful: npm publish --dry-run --access public
  • Merge this PR
  • Trigger GitHub Actions workflow with version 2.9.12
  • Verify package publishes successfully to npm

🤖 Generated with Claude Code

Dion Low and others added 6 commits December 16, 2025 14:48
- Fixes npm publish failure for scoped package @amp-labs/react
- npm requires explicit --access public for scoped packages
- Without this flag, npm assumes private access which causes "Not found" error
- Bump version to 2.9.12

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add dry_run input parameter (boolean, defaults to false)
- When enabled, runs npm publish --dry-run instead of actual publish
- Skips git push when dry_run is enabled
- Use github.ref instead of hardcoded 'main' to support running from branches

This allows testing the publish workflow without actually publishing to npm.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add id-token: write permission for OIDC authentication
- Add contents: write permission for git push operations
- Use --provenance flag to generate attestation
- Remove NPM_TOKEN secret dependency (no longer needed)
- More secure: uses short-lived tokens from GitHub OIDC

Requires trusted publisher to be configured on npm for @amp-labs/react.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Remove --access public flag (not needed with OIDC)
- Remove --provenance flag (handled automatically by OIDC)
- Follow npm trusted publisher documentation recommendations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Comment on lines 54 to 60
run: |
if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then
echo "Running dry-run publish..."
npm publish --dry-run --tag ${{ github.event.inputs.tag }}
else
npm publish --tag ${{ github.event.inputs.tag }}
fi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL: Missing --access public flag - The PR title and description claim to add --access public flag to fix scoped package publishing, but the flag is not present in either publish command. This means the exact issue the PR is supposed to fix will still occur.

run: |
  if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then
    echo "Running dry-run publish..."
    npm publish --dry-run --access public --tag ${{ github.event.inputs.tag }}
  else
    npm publish --access public --tag ${{ github.event.inputs.tag }}
  fi
Suggested change
run: |
if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then
echo "Running dry-run publish..."
npm publish --dry-run --tag ${{ github.event.inputs.tag }}
else
npm publish --tag ${{ github.event.inputs.tag }}
fi
run: |
if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then
echo "Running dry-run publish..."
npm publish --dry-run --access public --tag ${{ github.event.inputs.tag }}
else
npm publish --access public --tag ${{ github.event.inputs.tag }}
fi

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants