Skip to content

Commit 089aa7e

Browse files
committed
Add caveat for Yarn 2+ and private repos
1 parent 094c36e commit 089aa7e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Diff for: docs/advanced-usage.md

+20
Original file line numberDiff line numberDiff line change
@@ -247,5 +247,25 @@ steps:
247247
# `npm rebuild` will run all those post-install scripts for us.
248248
- run: npm rebuild && npm run prepare --if-present
249249
```
250+
### Yarn2 configuration
251+
Yarn2 ignores both .npmrc and .yarnrc files created by the action, so before installing dependencies from the private repo it is necessary either to create or to modify existing yarnrc.yml file with `yarn config set` commands.
250252

253+
Below there's a sample "Setup .yarnrc.yml" step to configure private github registy for `my-org` organisation.
254+
255+
```yaml
256+
steps:
257+
- uses: actions/checkout@v3
258+
- uses: actions/setup-node@v3
259+
with:
260+
node-version: '14.x'
261+
- name: Setup .yarnrc.yml
262+
run: |
263+
yarn config set npmScopes.my-org.npmRegistryServer "https://npm.pkg.github.com"
264+
yarn config set npmScopes.my-org.npmAlwaysAuth true
265+
yarn config set npmScopes.my-org.npmAuthToken $NPM_AUTH_TOKEN
266+
env:
267+
NPM_AUTH_TOKEN: ${{ secrets.YARN_TOKEN }}
268+
- name: Install dependencies
269+
run: yarn install --immutable
270+
```
251271
NOTE: As per https://github.com/actions/setup-node/issues/49 you cannot use `secrets.GITHUB_TOKEN` to access private GitHub Packages within the same organisation but in a different repository.

0 commit comments

Comments
 (0)