Skip to content

Commit e954e15

Browse files
Merge pull request #561 from akv-platform/v-sdolin/yarn2
Add caveat for Yarn 2+ and private repos
2 parents 094c36e + 792255d commit e954e15

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/advanced-usage.md

Lines changed: 20 additions & 0 deletions
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 you can find a sample "Setup .yarnrc.yml" step, that is going to allow you to configure a private GitHub registry 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)