Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jdeblasse opened this issue Jul 11, 2022 · 7 comments
Closed

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

jdeblasse opened this issue Jul 11, 2022 · 7 comments
Assignees
Labels
feature request New feature or request to improve the current logic

Comments

@jdeblasse
Copy link

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
@jdeblasse jdeblasse added feature request New feature or request to improve the current logic needs triage labels Jul 11, 2022
@dmitry-shibanov
Copy link
Contributor

Hello @jdeblasse. Thank you for your report. We'll investigate the feature request.

@Ttamez68A
Copy link

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

@dsame dsame self-assigned this Aug 16, 2022
@dsame
Copy link
Contributor

dsame commented Aug 18, 2022

Status update. I do not confirm so far we have a problem with the scoped yarn config.

The scoped package works without issue with npmjs repository without extra configurations https://github.com/akv-demo/setup-node-test/runs/7906221779?check_suite_focus=true

But with the github repository there's an authentication problem.

@dsame
Copy link
Contributor

dsame commented Aug 19, 2022

@jdeblasse
Thanks for your input, you are right: it is confirmed yarn2 must have extra configuration step to access scoped/private registries.
But please share you opinion - why we should add the workaround to the docs instead of creating the proper .yarnrc.yml during the setup action?

@jdeblasse
Copy link
Author

jdeblasse commented Aug 19, 2022

@dsame No opinion really. If possible, creating the .yarnrc.yml on the fly is, of course, easier for the end user. It would have to merge with any current .yarnrc.yml files that may be present in the repo. The only potential issue I see with this approach is currently, inputs for setup-node include registry, scope and token as single entries however yarn 2+ allows for multiple-scoped registries. That said, it still seems best to me that setup-node creates/merges the .yarnrc.yml just as it does currently with .npmrc and .yarnrc.

@dsame
Copy link
Contributor

dsame commented Aug 22, 2022

The issue is to be closed with PR
Generating the .yarnrc.yml does not seem to be practical solution because of current version yarn is 1 on the image.

@dsame
Copy link
Contributor

dsame commented Aug 22, 2022

I close the issue with providing docs
@jdeblasse please feel free to reopen the issue or create new one if the problem still exists

@dsame dsame closed this as completed Aug 22, 2022
deining pushed a commit to deining/setup-node that referenced this issue Nov 9, 2023
…ctions#537)

Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 6.3.0 to 6.4.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.4.1/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request to improve the current logic
Projects
None yet
Development

No branches or pull requests

4 participants