Skip to content

docs: Consider caveat for Yarn 2+ and private repos #537

@jdeblasse

Description

@jdeblasse

Description:
Consider adding caveat documentation for using Yarn 2+ with private repos in the Advanced usage section. Yarn 2+ ignores both .npmrc and .yarnrc files so any auth settings via setup-node are ignored when using Yarn 2+.

Basic usage

Per Yarn's docs regarding snake-cased, prefixed vars. Tested and working.

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
  with:
    node-version: '16.x'
- name: Install dependencies
  run: yarn install --immutable
  env:
    YARN_NPM_AUTH_TOKEN: ${{ secrets.YARN_TOKEN }}

Scoped usage

Untested code however should work as described. my-org should be replaced by the scoped name. Complex objects can not be set using Yarn's prefixed env vars so this must be done via command line config.

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
  with:
    node-version: '16.x'
- name: Setup .yarnrc.yml
  run: |
    yarn config set npmScopes.my-org.npmRegistryServer "https://npm.pkg.github.com"
    yarn config set npmScopes.my-org.npmAlwaysAuth true
    yarn config set npmScopes.my-org.npmAuthToken $NPM_AUTH_TOKEN
  env:
    NPM_AUTH_TOKEN: ${{ secrets.YARN_TOKEN }}
- name: Install dependencies
  run: yarn install --immutable

Metadata

Metadata

Assignees

Labels

feature requestNew feature or request to improve the current logic

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