From 089aa7ea918421102c1e1dfa8ef95982aee6b0af Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Fri, 19 Aug 2022 12:21:26 +0200 Subject: [PATCH 1/2] Add caveat for Yarn 2+ and private repos --- docs/advanced-usage.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/advanced-usage.md b/docs/advanced-usage.md index 0cf12ca4..da5397be 100644 --- a/docs/advanced-usage.md +++ b/docs/advanced-usage.md @@ -247,5 +247,25 @@ steps: # `npm rebuild` will run all those post-install scripts for us. - run: npm rebuild && npm run prepare --if-present ``` +### Yarn2 configuration +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. +Below there's a sample "Setup .yarnrc.yml" step to configure private github registy for `my-org` organisation. + +```yaml +steps: +- uses: actions/checkout@v3 +- uses: actions/setup-node@v3 + with: + node-version: '14.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 +``` 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. From 792255d078993de3ffd3641db1e5994ca1cef656 Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Mon, 22 Aug 2022 08:20:41 +0200 Subject: [PATCH 2/2] Fix wording --- docs/advanced-usage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/advanced-usage.md b/docs/advanced-usage.md index da5397be..00f4198d 100644 --- a/docs/advanced-usage.md +++ b/docs/advanced-usage.md @@ -250,7 +250,7 @@ steps: ### Yarn2 configuration 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. -Below there's a sample "Setup .yarnrc.yml" step to configure private github registy for `my-org` organisation. +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. ```yaml steps: