Skip to content

Instantly share code, notes, and snippets.

@belgattitude
Last active October 14, 2025 07:43
Show Gist options
  • Select an option

  • Save belgattitude/042f9caf10d029badbde6cf9d43e400a to your computer and use it in GitHub Desktop.

Select an option

Save belgattitude/042f9caf10d029badbde6cf9d43e400a to your computer and use it in GitHub Desktop.

Revisions

  1. belgattitude revised this gist Oct 14, 2025. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -152,16 +152,17 @@ runs:
    ### Workflow action
    To use it in the workflows
    To use it in a workflow (please be sure to set package-manager-cache to false in setup/node >= 5)
    ```yml
    steps:
    - uses: actions/checkout@v4
    - uses: actions/checkout@v5

    - name: Use Node.js ${{ matrix.node-version }}
    uses: actions/setup-node@v4
    uses: actions/setup-node@v6
    with:
    node-version: ${{ matrix.node-version }}
    package-manager-cache: false

    - name: 📥 Monorepo install
    uses: ./.github/actions/yarn-nm-install
  2. belgattitude revised this gist May 24, 2024. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -131,7 +131,7 @@ runs:
    - name: ♻️ Restore yarn install state
    if: inputs.cache-install-state == 'true' && inputs.cache-node-modules == 'true'
    id: yarn-install-state-cache
    uses: actions/cache@v3
    uses: actions/cache@v4
    with:
    path: ${{ inputs.cwd }}/.yarn/ci-cache
    key: yarn-install-state-cache-${{ inputs.cache-prefix }}-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ steps.yarn-config.outputs.CURRENT_BRANCH }}-${{ hashFiles(format('{0}/yarn.lock', inputs.cwd), format('{0}/.yarnrc.yml', inputs.cwd)) }}
    @@ -271,7 +271,7 @@ jobs:
    runs-on: ubuntu-latest
    steps:
    - name: Check out code
    uses: actions/checkout@v3
    uses: actions/checkout@v4
    - name: Cleanup
    run: |
  3. belgattitude revised this gist May 24, 2024. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -43,6 +43,7 @@ Create a file in `.github/actions/yarn-nm-install/action.yml` and paste
    # - latest: https://gist.github.com/belgattitude/042f9caf10d029badbde6cf9d43e400a #
    # #
    # Versions: #
    # - 1.2.1 - 25-05-2024 - fix a missing action/cache not upraded to v4 #
    # - 1.2.0 - 01-05-2024 - action/cache upraded to v4 #
    # - 1.1.0 - 22-07-2023 - Option to enable npm global cache folder. #
    # - 1.0.4 - 15-07-2023 - Fix corepack was always enabled. #
    @@ -114,7 +115,7 @@ runs:
    - name: ♻️ Restore node_modules
    if: inputs.cache-node-modules == 'true'
    id: yarn-nm-cache
    uses: actions/cache@v3
    uses: actions/cache@v4
    with:
    path: ${{ inputs.cwd }}/**/node_modules
    key: yarn-nm-cache-${{ inputs.cache-prefix }}-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ steps.yarn-config.outputs.CURRENT_BRANCH }}-${{ hashFiles(format('{0}/yarn.lock', inputs.cwd), format('{0}/.yarnrc.yml', inputs.cwd)) }}
  4. belgattitude revised this gist May 1, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -43,7 +43,7 @@ Create a file in `.github/actions/yarn-nm-install/action.yml` and paste
    # - latest: https://gist.github.com/belgattitude/042f9caf10d029badbde6cf9d43e400a #
    # #
    # Versions: #
    # - 1.2.0 - 01-05-2024 - action/cache upraded to v4
    # - 1.2.0 - 01-05-2024 - action/cache upraded to v4 #
    # - 1.1.0 - 22-07-2023 - Option to enable npm global cache folder. #
    # - 1.0.4 - 15-07-2023 - Fix corepack was always enabled. #
    # - 1.0.3 - 05-07-2023 - YARN_ENABLE_MIRROR to false (speed up cold start) #
  5. belgattitude revised this gist May 1, 2024. 1 changed file with 6 additions and 5 deletions.
    11 changes: 6 additions & 5 deletions ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ Although @setup/node as a [built-in cache option](https://github.com/actions/set

    ### Requirements

    Yarn 3+ with [nodeLinker: node-modules](https://yarnpkg.com/configuration/yarnrc#nodeLinker). (Not using yarn ? see the corresponding [pnpm 7/8+ action gist](https://gist.github.com/belgattitude/838b2eba30c324f1f0033a797bab2e31))
    Yarn 3+/4+ with [nodeLinker: node-modules](https://yarnpkg.com/configuration/yarnrc#nodeLinker). (Not using yarn ? see the corresponding [pnpm 7/8+ action gist](https://gist.github.com/belgattitude/838b2eba30c324f1f0033a797bab2e31))


    ### Structure
    @@ -43,6 +43,7 @@ Create a file in `.github/actions/yarn-nm-install/action.yml` and paste
    # - latest: https://gist.github.com/belgattitude/042f9caf10d029badbde6cf9d43e400a #
    # #
    # Versions: #
    # - 1.2.0 - 01-05-2024 - action/cache upraded to v4
    # - 1.1.0 - 22-07-2023 - Option to enable npm global cache folder. #
    # - 1.0.4 - 15-07-2023 - Fix corepack was always enabled. #
    # - 1.0.3 - 05-07-2023 - YARN_ENABLE_MIRROR to false (speed up cold start) #
    @@ -102,7 +103,7 @@ runs:
    echo "NPM_GLOBAL_CACHE_FOLDER=$(npm config get cache)" >> $GITHUB_OUTPUT
    - name: ♻️ Restore yarn cache
    uses: actions/cache@v3
    uses: actions/cache@v4
    id: yarn-download-cache
    with:
    path: ${{ steps.yarn-config.outputs.CACHE_FOLDER }}
    @@ -121,7 +122,7 @@ runs:
    - name: ♻️ Restore global npm cache folder
    if: inputs.cache-npm-cache == 'true'
    id: npm-global-cache
    uses: actions/cache@v3
    uses: actions/cache@v4
    with:
    path: ${{ steps.yarn-config.outputs.NPM_GLOBAL_CACHE_FOLDER }}
    key: npm-global-cache-${{ inputs.cache-prefix }}-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ hashFiles(format('{0}/yarn.lock', inputs.cwd), format('{0}/.yarnrc.yml', inputs.cwd)) }}
    @@ -154,10 +155,10 @@ To use it in the workflows
    ```yml
    steps:
    - uses: actions/checkout@v3
    - uses: actions/checkout@v4

    - name: Use Node.js ${{ matrix.node-version }}
    uses: actions/setup-node@v3
    uses: actions/setup-node@v4
    with:
    node-version: ${{ matrix.node-version }}

  6. belgattitude revised this gist Jul 22, 2023. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -59,13 +59,13 @@ inputs:
    required: false
    default: '.'
    cache-prefix:
    description: "Add a specific cache-prefix"
    description: 'Add a specific cache-prefix'
    required: false
    default: 'default'
    cache-npm-cache:
    description: 'Cache npm global cache folder often used by node-gyp, prebuild binaries (invalidated on lock/os/node-version)'
    required: false
    default: 'true'
    default: 'true'
    cache-node-modules:
    description: 'Cache node_modules, might speed up link step (invalidated lock/os/node-version/branch)'
    required: false
    @@ -77,7 +77,7 @@ inputs:
    enable-corepack:
    description: 'Enable corepack'
    required: false
    default: 'false'
    default: 'true'

    runs:
    using: 'composite'
    @@ -99,6 +99,7 @@ runs:
    echo "CACHE_FOLDER=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
    echo "CURRENT_NODE_VERSION="node-$(node --version)"" >> $GITHUB_OUTPUT
    echo "CURRENT_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's,/,-,g')" >> $GITHUB_OUTPUT
    echo "NPM_GLOBAL_CACHE_FOLDER=$(npm config get cache)" >> $GITHUB_OUTPUT
    - name: ♻️ Restore yarn cache
    uses: actions/cache@v3
    @@ -139,13 +140,12 @@ runs:
    run: yarn install --immutable --inline-builds
    env:
    # Overrides/align yarnrc.yml options (v3, v4) for a CI context
    YARN_ENABLE_GLOBAL_CACHE: 'false' # Use local cache folder to keep downloaded archives
    YARN_ENABLE_MIRROR: 'false' # Prevent populating global cache for caches misses (local cache only)
    YARN_NM_MODE: 'hardlinks-local' # Reduce node_modules size
    YARN_ENABLE_GLOBAL_CACHE: 'false' # Use local cache folder to keep downloaded archives
    YARN_ENABLE_MIRROR: 'false' # Prevent populating global cache for caches misses (local cache only)
    YARN_NM_MODE: 'hardlinks-local' # Reduce node_modules size
    YARN_INSTALL_STATE_PATH: '.yarn/ci-cache/install-state.gz' # Might speed up resolution step when node_modules present
    # Other environment variables
    HUSKY: '0' # By default do not run HUSKY install

    ```
    ### Workflow action
  7. belgattitude revised this gist Jul 22, 2023. 1 changed file with 13 additions and 0 deletions.
    13 changes: 13 additions & 0 deletions ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -43,6 +43,7 @@ Create a file in `.github/actions/yarn-nm-install/action.yml` and paste
    # - latest: https://gist.github.com/belgattitude/042f9caf10d029badbde6cf9d43e400a #
    # #
    # Versions: #
    # - 1.1.0 - 22-07-2023 - Option to enable npm global cache folder. #
    # - 1.0.4 - 15-07-2023 - Fix corepack was always enabled. #
    # - 1.0.3 - 05-07-2023 - YARN_ENABLE_MIRROR to false (speed up cold start) #
    # - 1.0.2 - 02-06-2023 - install-state default to false #
    @@ -61,6 +62,10 @@ inputs:
    description: "Add a specific cache-prefix"
    required: false
    default: 'default'
    cache-npm-cache:
    description: 'Cache npm global cache folder often used by node-gyp, prebuild binaries (invalidated on lock/os/node-version)'
    required: false
    default: 'true'
    cache-node-modules:
    description: 'Cache node_modules, might speed up link step (invalidated lock/os/node-version/branch)'
    required: false
    @@ -112,6 +117,14 @@ runs:
    path: ${{ inputs.cwd }}/**/node_modules
    key: yarn-nm-cache-${{ inputs.cache-prefix }}-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ steps.yarn-config.outputs.CURRENT_BRANCH }}-${{ hashFiles(format('{0}/yarn.lock', inputs.cwd), format('{0}/.yarnrc.yml', inputs.cwd)) }}

    - name: ♻️ Restore global npm cache folder
    if: inputs.cache-npm-cache == 'true'
    id: npm-global-cache
    uses: actions/cache@v3
    with:
    path: ${{ steps.yarn-config.outputs.NPM_GLOBAL_CACHE_FOLDER }}
    key: npm-global-cache-${{ inputs.cache-prefix }}-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ hashFiles(format('{0}/yarn.lock', inputs.cwd), format('{0}/.yarnrc.yml', inputs.cwd)) }}

    - name: ♻️ Restore yarn install state
    if: inputs.cache-install-state == 'true' && inputs.cache-node-modules == 'true'
    id: yarn-install-state-cache
  8. belgattitude revised this gist Jul 15, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -43,7 +43,7 @@ Create a file in `.github/actions/yarn-nm-install/action.yml` and paste
    # - latest: https://gist.github.com/belgattitude/042f9caf10d029badbde6cf9d43e400a #
    # #
    # Versions: #
    # - 1.0.4 - 15-07-2023 - Fix corepack was always enabled.
    # - 1.0.4 - 15-07-2023 - Fix corepack was always enabled. #
    # - 1.0.3 - 05-07-2023 - YARN_ENABLE_MIRROR to false (speed up cold start) #
    # - 1.0.2 - 02-06-2023 - install-state default to false #
    # - 1.0.1 - 29-05-2023 - cache-prefix doc #
  9. belgattitude revised this gist Jul 15, 2023. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -43,6 +43,7 @@ Create a file in `.github/actions/yarn-nm-install/action.yml` and paste
    # - latest: https://gist.github.com/belgattitude/042f9caf10d029badbde6cf9d43e400a #
    # #
    # Versions: #
    # - 1.0.4 - 15-07-2023 - Fix corepack was always enabled.
    # - 1.0.3 - 05-07-2023 - YARN_ENABLE_MIRROR to false (speed up cold start) #
    # - 1.0.2 - 02-06-2023 - install-state default to false #
    # - 1.0.1 - 29-05-2023 - cache-prefix doc #
    @@ -78,7 +79,7 @@ runs:

    steps:
    - name: ⚙️ Enable Corepack
    if: ${{ inputs.enable-corepack }} == 'true'
    if: inputs.enable-corepack == 'true'
    shell: bash
    working-directory: ${{ inputs.cwd }}
    run: corepack enable
  10. belgattitude revised this gist Jul 5, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -126,8 +126,8 @@ runs:
    env:
    # Overrides/align yarnrc.yml options (v3, v4) for a CI context
    YARN_ENABLE_GLOBAL_CACHE: 'false' # Use local cache folder to keep downloaded archives
    YARN_ENABLE_MIRROR: 'false' # Prevent populating global cache for caches misses (local cache only)
    YARN_NM_MODE: 'hardlinks-local' # Reduce node_modules size
    YARN_ENABLE_MIRROR: 'false' # Prevent populating global cache for caches misses
    YARN_INSTALL_STATE_PATH: '.yarn/ci-cache/install-state.gz' # Might speed up resolution step when node_modules present
    # Other environment variables
    HUSKY: '0' # By default do not run HUSKY install
  11. belgattitude revised this gist Jul 5, 2023. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -43,6 +43,7 @@ Create a file in `.github/actions/yarn-nm-install/action.yml` and paste
    # - latest: https://gist.github.com/belgattitude/042f9caf10d029badbde6cf9d43e400a #
    # #
    # Versions: #
    # - 1.0.3 - 05-07-2023 - YARN_ENABLE_MIRROR to false (speed up cold start) #
    # - 1.0.2 - 02-06-2023 - install-state default to false #
    # - 1.0.1 - 29-05-2023 - cache-prefix doc #
    # - 1.0.0 - 27-05-2023 - new input: cache-prefix #
    @@ -124,8 +125,9 @@ runs:
    run: yarn install --immutable --inline-builds
    env:
    # Overrides/align yarnrc.yml options (v3, v4) for a CI context
    YARN_ENABLE_GLOBAL_CACHE: 'false' # Use local cache folder to keep downloaded archives
    YARN_NM_MODE: 'hardlinks-local' # Reduce node_modules size
    YARN_ENABLE_GLOBAL_CACHE: 'false' # Use local cache folder to keep downloaded archives
    YARN_NM_MODE: 'hardlinks-local' # Reduce node_modules size
    YARN_ENABLE_MIRROR: 'false' # Prevent populating global cache for caches misses
    YARN_INSTALL_STATE_PATH: '.yarn/ci-cache/install-state.gz' # Might speed up resolution step when node_modules present
    # Other environment variables
    HUSKY: '0' # By default do not run HUSKY install
  12. belgattitude revised this gist Jun 2, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -111,7 +111,7 @@ runs:
    key: yarn-nm-cache-${{ inputs.cache-prefix }}-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ steps.yarn-config.outputs.CURRENT_BRANCH }}-${{ hashFiles(format('{0}/yarn.lock', inputs.cwd), format('{0}/.yarnrc.yml', inputs.cwd)) }}

    - name: ♻️ Restore yarn install state
    if: ${{ (inputs.cache-install-state == 'true') && (inputs.cache-node-modules == 'true') }}
    if: inputs.cache-install-state == 'true' && inputs.cache-node-modules == 'true'
    id: yarn-install-state-cache
    uses: actions/cache@v3
    with:
  13. belgattitude revised this gist Jun 2, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -111,7 +111,7 @@ runs:
    key: yarn-nm-cache-${{ inputs.cache-prefix }}-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ steps.yarn-config.outputs.CURRENT_BRANCH }}-${{ hashFiles(format('{0}/yarn.lock', inputs.cwd), format('{0}/.yarnrc.yml', inputs.cwd)) }}

    - name: ♻️ Restore yarn install state
    if: inputs.cache-install-state == 'true' && inputs.cache-node-modules == 'true'
    if: ${{ (inputs.cache-install-state == 'true') && (inputs.cache-node-modules == 'true') }}
    id: yarn-install-state-cache
    uses: actions/cache@v3
    with:
  14. belgattitude revised this gist Jun 2, 2023. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -43,6 +43,7 @@ Create a file in `.github/actions/yarn-nm-install/action.yml` and paste
    # - latest: https://gist.github.com/belgattitude/042f9caf10d029badbde6cf9d43e400a #
    # #
    # Versions: #
    # - 1.0.2 - 02-06-2023 - install-state default to false #
    # - 1.0.1 - 29-05-2023 - cache-prefix doc #
    # - 1.0.0 - 27-05-2023 - new input: cache-prefix #
    ########################################################################################
    @@ -65,7 +66,7 @@ inputs:
    cache-install-state:
    description: 'Cache yarn install state, might speed up resolution step when node-modules cache is activated (invalidated lock/os/node-version/branch)'
    required: false
    default: 'true'
    default: 'false'
    enable-corepack:
    description: 'Enable corepack'
    required: false
  15. belgattitude revised this gist Jun 2, 2023. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -155,7 +155,9 @@ Be sure that your `.yarnrc.yml` sets the `nodeLinker: node-modules` parameter:
    ```yaml
    nodeLinker: node-modules
    # This line can be omiited with corepack enabled in this case set the packageManager field in package.json
    #compressionLevel: 0 # Will give 10%-30% install speed up, but takes more space locally
    # This line can be ommited if corepack is enabled (requires the packageManager field in package.json)
    yarnPath: .yarn/releases/yarn-3.6.0.cjs # or 4.0.0-rc.45 (rc's seems quite stable imho)...
    ```

  16. belgattitude revised this gist Jun 2, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -156,7 +156,7 @@ Be sure that your `.yarnrc.yml` sets the `nodeLinker: node-modules` parameter:
    nodeLinker: node-modules
    # This line can be omiited with corepack enabled in this case set the packageManager field in package.json
    yarnPath: .yarn/releases/yarn-4.0.0-rc.44.cjs # or 3.5.1 (rc are really stable imho)...
    yarnPath: .yarn/releases/yarn-3.6.0.cjs # or 4.0.0-rc.45 (rc's seems quite stable imho)...
    ```


  17. belgattitude revised this gist Jun 2, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -34,7 +34,7 @@ Create a file in `.github/actions/yarn-nm-install/action.yml` and paste
    # uses: ./.github/actions/yarn-nm-install #
    # with: #
    # enable-corepack: false # (default = 'false') #
    # cwd: ${{ github.workspace/apps/strapi }} # (default = '.') #
    # cwd: ${{ github.workspace }}/apps/my-app # (default = '.') #
    # cache-prefix: add cache key prefix # (default = 'default') #
    # cache-node-modules: false # (default = 'false') #
    # cache-install-state: false # (default = 'false') #
  18. belgattitude revised this gist May 29, 2023. 1 changed file with 8 additions and 7 deletions.
    15 changes: 8 additions & 7 deletions ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -35,7 +35,7 @@ Create a file in `.github/actions/yarn-nm-install/action.yml` and paste
    # with: #
    # enable-corepack: false # (default = 'false') #
    # cwd: ${{ github.workspace/apps/strapi }} # (default = '.') #
    # cache-prefix: add cacge key prefix # (default = 'default') #
    # cache-prefix: add cache key prefix # (default = 'default') #
    # cache-node-modules: false # (default = 'false') #
    # cache-install-state: false # (default = 'false') #
    # #
    @@ -173,12 +173,13 @@ yarnPath: .yarn/releases/yarn-4.0.0-rc.44.cjs # or 3.5.1 (rc are really stable i
    ```


    | Parameter | Default | Comment |
    |----------------------|---------|-------------------------------------------------------|
    | cwd | '.' | Run the install in a specific folder |
    | enable-corepack | `false` | Activate corepack |
    | cache-node-modules | `false` | Cache node-modules (only for exceptional use-cases) |
    | cache-install-state | `false` | Only useful is cache-node-modules is activated |
    | Parameter | Default | Comment |
    |----------------------|-----------|-------------------------------------------------------|
    | cwd | '.' | Run the install in a specific folder. |
    | enable-corepack | `false` | Activate corepack. |
    | cache-prefix | `default` | Allows to have multiple distinct install. |
    | cache-node-modules | `false` | Cache node-modules (only for exceptional use-cases) |
    | cache-install-state | `false` | Only useful is cache-node-modules is activated |


    This action always caches the `yarn config get cacheFolder` to avoid fetching archives
  19. belgattitude revised this gist May 29, 2023. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -33,15 +33,17 @@ Create a file in `.github/actions/yarn-nm-install/action.yml` and paste
    # - name: 📥 Monorepo install #
    # uses: ./.github/actions/yarn-nm-install #
    # with: #
    # enable-corepack: false # (default) #
    # cache-node-modules: false # (default) #
    # cache-install-state: false # (default) #
    # enable-corepack: false # (default = 'false') #
    # cwd: ${{ github.workspace/apps/strapi }} # (default = '.') #
    # cache-prefix: add cacge key prefix # (default = 'default') #
    # cache-node-modules: false # (default = 'false') #
    # cache-install-state: false # (default = 'false') #
    # #
    # Reference: #
    # - latest: https://gist.github.com/belgattitude/042f9caf10d029badbde6cf9d43e400a #
    # #
    # Versions: #
    # - 1.0.1 - 29-05-2023 - cache-prefix doc #
    # - 1.0.0 - 27-05-2023 - new input: cache-prefix #
    ########################################################################################

  20. belgattitude revised this gist May 27, 2023. 1 changed file with 11 additions and 4 deletions.
    15 changes: 11 additions & 4 deletions ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -40,6 +40,9 @@ Create a file in `.github/actions/yarn-nm-install/action.yml` and paste
    # #
    # Reference: #
    # - latest: https://gist.github.com/belgattitude/042f9caf10d029badbde6cf9d43e400a #
    # #
    # Versions: #
    # - 1.0.0 - 27-05-2023 - new input: cache-prefix #
    ########################################################################################

    name: 'Monorepo install (yarn)'
    @@ -49,6 +52,10 @@ inputs:
    description: "Changes node's process.cwd() if the project is not located on the root. Default to process.cwd()"
    required: false
    default: '.'
    cache-prefix:
    description: "Add a specific cache-prefix"
    required: false
    default: 'default'
    cache-node-modules:
    description: 'Cache node_modules, might speed up link step (invalidated lock/os/node-version/branch)'
    required: false
    @@ -88,25 +95,25 @@ runs:
    id: yarn-download-cache
    with:
    path: ${{ steps.yarn-config.outputs.CACHE_FOLDER }}
    key: yarn-download-cache-${{ hashFiles(format('{0}/yarn.lock', inputs.cwd), format('{0}/.yarnrc.yml', inputs.cwd)) }}
    key: yarn-download-cache-${{ inputs.cache-prefix }}-${{ hashFiles(format('{0}/yarn.lock', inputs.cwd), format('{0}/.yarnrc.yml', inputs.cwd)) }}
    restore-keys: |
    yarn-download-cache-
    yarn-download-cache-${{ inputs.cache-prefix }}-
    - name: ♻️ Restore node_modules
    if: inputs.cache-node-modules == 'true'
    id: yarn-nm-cache
    uses: actions/cache@v3
    with:
    path: ${{ inputs.cwd }}/**/node_modules
    key: yarn-nm-cache-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ steps.yarn-config.outputs.CURRENT_BRANCH }}-${{ hashFiles(format('{0}/yarn.lock', inputs.cwd), format('{0}/.yarnrc.yml', inputs.cwd)) }}
    key: yarn-nm-cache-${{ inputs.cache-prefix }}-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ steps.yarn-config.outputs.CURRENT_BRANCH }}-${{ hashFiles(format('{0}/yarn.lock', inputs.cwd), format('{0}/.yarnrc.yml', inputs.cwd)) }}

    - name: ♻️ Restore yarn install state
    if: inputs.cache-install-state == 'true' && inputs.cache-node-modules == 'true'
    id: yarn-install-state-cache
    uses: actions/cache@v3
    with:
    path: ${{ inputs.cwd }}/.yarn/ci-cache
    key: yarn-install-state-cache-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ steps.yarn-config.outputs.CURRENT_BRANCH }}-${{ hashFiles(format('{0}/yarn.lock', inputs.cwd), format('{0}/.yarnrc.yml', inputs.cwd)) }}
    key: yarn-install-state-cache-${{ inputs.cache-prefix }}-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ steps.yarn-config.outputs.CURRENT_BRANCH }}-${{ hashFiles(format('{0}/yarn.lock', inputs.cwd), format('{0}/.yarnrc.yml', inputs.cwd)) }}

    - name: 📥 Install dependencies
    shell: bash
  21. belgattitude revised this gist May 27, 2023. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -167,9 +167,9 @@ yarnPath: .yarn/releases/yarn-4.0.0-rc.44.cjs # or 3.5.1 (rc are really stable i
    | Parameter | Default | Comment |
    |----------------------|---------|-------------------------------------------------------|
    | cwd | '.' | Run the install in a specific folder |
    | enable-corepack | 'false' | Activate corepack |
    | cache-node-modules | 'false' | Cache node-modules (only for exceptional use-cases) |
    | cache-install-state | 'false' | Only useful is cache-node-modules is activated |
    | enable-corepack | `false` | Activate corepack |
    | cache-node-modules | `false` | Cache node-modules (only for exceptional use-cases) |
    | cache-install-state | `false` | Only useful is cache-node-modules is activated |


    This action always caches the `yarn config get cacheFolder` to avoid fetching archives
  22. belgattitude revised this gist May 27, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -189,7 +189,7 @@ Link: https://github.com/belgattitude/compare-package-managers#-install-speed
    In some circumstances, you might archieve better install time by caching the `node_modules` folder as well.
    This will impact the `yarn link step`. The link step is where yarn runs postinstalls (node-gyp, download binaries...).
    But be aware that the time saved by doing this creates an overhead for the cache fetch/compression/persist (@action/cache
    has more to deal with). Use this option with care and in exceptional circumstances (ie you have multiple dependendent steps that run install). Also remember that the node_modules folder does not have the same portability/reliability than the recommended yarn cache folder. To get an idea of the performance gains, see this issure:
    has more to deal with). Use this option with care and in exceptional circumstances (ie you have multiple dependendent steps that run install). Also remember that the node_modules folder does not have the same portability/reliability than the recommended yarn cache folder. To get an idea of the performance gains, see this table:


    | Command | Mean [s] | Min [s] | Max [s] | Relative |
  23. belgattitude revised this gist May 27, 2023. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -6,9 +6,6 @@ Although @setup/node as a [built-in cache option](https://github.com/actions/set

    Yarn 3+ with [nodeLinker: node-modules](https://yarnpkg.com/configuration/yarnrc#nodeLinker). (Not using yarn ? see the corresponding [pnpm 7/8+ action gist](https://gist.github.com/belgattitude/838b2eba30c324f1f0033a797bab2e31))

    ### Bench

    With cache: at least twice faster than without (see PS at the bottom for results)

    ### Structure

  24. belgattitude revised this gist May 27, 2023. 1 changed file with 57 additions and 30 deletions.
    87 changes: 57 additions & 30 deletions ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -48,10 +48,10 @@ Create a file in `.github/actions/yarn-nm-install/action.yml` and paste
    name: 'Monorepo install (yarn)'
    description: 'Run yarn install with node_modules linker and cache enabled'
    inputs:
    enable-corepack:
    description: 'Enable corepack'
    cwd:
    description: "Changes node's process.cwd() if the project is not located on the root. Default to process.cwd()"
    required: false
    default: 'false'
    default: '.'
    cache-node-modules:
    description: 'Cache node_modules, might speed up link step (invalidated lock/os/node-version/branch)'
    required: false
    @@ -60,10 +60,10 @@ inputs:
    description: 'Cache yarn install state, might speed up resolution step when node-modules cache is activated (invalidated lock/os/node-version/branch)'
    required: false
    default: 'true'
    cwd:
    description: "Changes node's process.cwd() if the project is not located on the root. Default to process.cwd()"
    enable-corepack:
    description: 'Enable corepack'
    required: false
    default: '.'
    default: 'false'

    runs:
    using: 'composite'
    @@ -142,30 +142,69 @@ To use it in the workflows
    uses: ./.github/actions/yarn-nm-install
    ```
    The action accepts few parameters, for example if saving node_modules is what you're looking for: set the cache-node-modules and cache-install-state to true. **This option is really worth in complex workflows - install is fully shared between jobs at the cost of @action/cache compression which is lighter in general)**
    ### Yarn config
    Be sure that your `.yarnrc.yml` sets the `nodeLinker: node-modules` parameter:

    ```yaml
    nodeLinker: node-modules
    # This line can be omiited with corepack enabled in this case set the packageManager field in package.json
    yarnPath: .yarn/releases/yarn-4.0.0-rc.44.cjs # or 3.5.1 (rc are really stable imho)...
    ```


    ### Input parameters

    ```yml
    - name: 📥 Monorepo install
    uses: ./.github/actions/yarn-nm-install
    with:
    enable-corepack: false
    cwd: '.'
    enable-corepack: false
    cache-node-modules: true
    cache-install-state: true
    cache-node-modules: true
    ```

    **Caution** `cache-node_modules` is false by default, but you might try both options on your specific repo. It's a balance between cache persitence/restoration speed/size and install time. There's no one rule that fits all. In general if you want to reuse between multiple steps, cache-node-modules to true is ideal. But be **warned** in some situations (prisma postinstall generation...) there might be issues.

    | Parameter | Default | Comment |
    |----------------------|---------|-------------------------------------------------------|
    | cwd | '.' | Run the install in a specific folder |
    | enable-corepack | 'false' | Activate corepack |
    | cache-node-modules | 'false' | Cache node-modules (only for exceptional use-cases) |
    | cache-install-state | 'false' | Only useful is cache-node-modules is activated |

    ### yarnrc.yml

    ```
    # .yarnrc.yml
    nodeLinker: node-modules
    # This line can be omiited with corepack enabled
    # in this case set the packageManager field in package.json
    yarnPath: .yarn/releases/yarn-4.0.0-rc.43.cjs # or 3.5.1 (rc are really stable imho)...
    This action always caches the `yarn config get cacheFolder` to avoid fetching archives
    from the npm repository. Depending on the number of your dependencies, this generally gives
    a 2x overall improvement. It affects the `yarn fetch step` and protects from npm outages as well. An example
    of speed gain could be:


    | CI Scenario | Install | CI fetch cache | Total | Cache size | CI persist cache |
    |-------------------------|--------:|---------------:|--------:|-----------:|-----------------:|
    | yarn4 with cache | 34s | 3s | **37s** | 201Mb | *(±5s)* |
    | yarn4 without cache | 83s | N/A | **83s** | N/A | N/A |


    Link: https://github.com/belgattitude/compare-package-managers#-install-speed

    In some circumstances, you might archieve better install time by caching the `node_modules` folder as well.
    This will impact the `yarn link step`. The link step is where yarn runs postinstalls (node-gyp, download binaries...).
    But be aware that the time saved by doing this creates an overhead for the cache fetch/compression/persist (@action/cache
    has more to deal with). Use this option with care and in exceptional circumstances (ie you have multiple dependendent steps that run install). Also remember that the node_modules folder does not have the same portability/reliability than the recommended yarn cache folder. To get an idea of the performance gains, see this issure:


    | Command | Mean [s] | Min [s] | Max [s] | Relative |
    |:-------------------------------------------|---------------:|--------:|--------:|------------:|
    | `yarnCache:on - installState:off - nm:off` | 22.717 ± 0.225 | 22.510 | 22.957 | 5.95 ± 0.25 |
    | `yarnCache:on - installState:on - nm:off` | 21.350 ± 0.216 | 21.185 | 21.595 | 5.59 ± 0.24 |
    | `yarnCache:on - installState:off - nm:on` | 11.676 ± 0.041 | 11.647 | 11.722 | 3.06 ± 0.13 |
    | `yarnCache:on - installState:on - nm:on` | 3.820 ± 0.156 | 3.645 | 3.946 | 1.00 |

    Link: https://github.com/belgattitude/compare-package-managers#compare-yarn-options


    ```

    ### Results

    @@ -228,17 +267,5 @@ jobs:
    GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    ```

    ## Bench details

    Based on the [nextjs-monorepo-example](https://github.com/belgattitude/nextjs-monorepo-example) and the results of https://github.com/belgattitude/compare-package-managers it's twice fast. Depending on repo (renovatebot...), the slight complexity increase in ci setup might worth it. Example based on yarn 4.0.0-rc.36 with most post install scripts disabled and supportedArchitecture: current.

    | CACHE | YARN_COMPRESSION_LEVEL=mixed (default) | YARN_COMPRESSION_LEVEL=0 |
    | ----------- | -------------------------------------- | -------------------------|
    | COLD | 1m38s | 44s |
    | FULL WARM | 54s | 18s |

    PS: YARN_COMPRESSION_LEVEL=0 disable zip compression, on the ci it creates 2-3 more extra seconds (github will (un-)zstd it),
    in your local install you'll have to deal with a bigger cache (it's a choice you need to do for all as it changes the yarn.lock md5 checksums)



  25. belgattitude revised this gist May 27, 2023. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -37,8 +37,8 @@ Create a file in `.github/actions/yarn-nm-install/action.yml` and paste
    # uses: ./.github/actions/yarn-nm-install #
    # with: #
    # enable-corepack: false # (default) #
    # cache-install-state: true # (default) #
    # cache-node-modules: false # (default) #
    # cache-install-state: false # (default) #
    # cwd: ${{ github.workspace/apps/strapi }} # (default = '.') #
    # #
    # Reference: #
    @@ -104,7 +104,7 @@ runs:
    key: yarn-nm-cache-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ steps.yarn-config.outputs.CURRENT_BRANCH }}-${{ hashFiles(format('{0}/yarn.lock', inputs.cwd), format('{0}/.yarnrc.yml', inputs.cwd)) }}

    - name: ♻️ Restore yarn install state
    if: inputs.cache-install-state == 'true'
    if: inputs.cache-install-state == 'true' && inputs.cache-node-modules == 'true'
    id: yarn-install-state-cache
    uses: actions/cache@v3
    with:
  26. belgattitude revised this gist May 20, 2023. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -37,7 +37,7 @@ Create a file in `.github/actions/yarn-nm-install/action.yml` and paste
    # uses: ./.github/actions/yarn-nm-install #
    # with: #
    # enable-corepack: false # (default) #
    # cache-install-state: false # (default) #
    # cache-install-state: true # (default) #
    # cache-node-modules: false # (default) #
    # cwd: ${{ github.workspace/apps/strapi }} # (default = '.') #
    # #
    @@ -59,7 +59,7 @@ inputs:
    cache-install-state:
    description: 'Cache yarn install state, might speed up resolution step when node-modules cache is activated (invalidated lock/os/node-version/branch)'
    required: false
    default: 'false'
    default: 'true'
    cwd:
    description: "Changes node's process.cwd() if the project is not located on the root. Default to process.cwd()"
    required: false
    @@ -104,7 +104,7 @@ runs:
    key: yarn-nm-cache-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ steps.yarn-config.outputs.CURRENT_BRANCH }}-${{ hashFiles(format('{0}/yarn.lock', inputs.cwd), format('{0}/.yarnrc.yml', inputs.cwd)) }}

    - name: ♻️ Restore yarn install state
    if: inputs.cache-install-state == 'true' && inputs.cache-node-modules == 'true'
    if: inputs.cache-install-state == 'true'
    id: yarn-install-state-cache
    uses: actions/cache@v3
    with:
  27. belgattitude revised this gist May 20, 2023. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -55,11 +55,11 @@ inputs:
    cache-node-modules:
    description: 'Cache node_modules, might speed up link step (invalidated lock/os/node-version/branch)'
    required: false
    default: 'true'
    default: 'false'
    cache-install-state:
    description: 'Cache yarn install state, might speed up resolution step when node-modules cache is activated (invalidated lock/os/node-version/branch)'
    required: false
    default: 'true'
    default: 'false'
    cwd:
    description: "Changes node's process.cwd() if the project is not located on the root. Default to process.cwd()"
    required: false
  28. belgattitude revised this gist May 6, 2023. 1 changed file with 7 additions and 6 deletions.
    13 changes: 7 additions & 6 deletions ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -55,11 +55,11 @@ inputs:
    cache-node-modules:
    description: 'Cache node_modules, might speed up link step (invalidated lock/os/node-version/branch)'
    required: false
    default: 'false'
    default: 'true'
    cache-install-state:
    description: 'Cache yarn install state, might speed up resolution step when node-modules cache is activated (invalidated lock/os/node-version/branch)'
    required: false
    default: 'false'
    default: 'true'
    cwd:
    description: "Changes node's process.cwd() if the project is not located on the root. Default to process.cwd()"
    required: false
    @@ -91,7 +91,7 @@ runs:
    id: yarn-download-cache
    with:
    path: ${{ steps.yarn-config.outputs.CACHE_FOLDER }}
    key: yarn-download-cache-${{ hashFiles('yarn.lock', '.yarnrc.yml') }}
    key: yarn-download-cache-${{ hashFiles(format('{0}/yarn.lock', inputs.cwd), format('{0}/.yarnrc.yml', inputs.cwd)) }}
    restore-keys: |
    yarn-download-cache-
    @@ -101,15 +101,15 @@ runs:
    uses: actions/cache@v3
    with:
    path: ${{ inputs.cwd }}/**/node_modules
    key: yarn-nm-cache-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ steps.yarn-config.outputs.CURRENT_BRANCH }}-${{ hashFiles('yarn.lock', '.yarnrc.yml') }}
    key: yarn-nm-cache-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ steps.yarn-config.outputs.CURRENT_BRANCH }}-${{ hashFiles(format('{0}/yarn.lock', inputs.cwd), format('{0}/.yarnrc.yml', inputs.cwd)) }}

    - name: ♻️ Restore yarn install state
    if: inputs.cache-install-state == 'true' && inputs.cache-node-modules == 'true'
    id: yarn-install-state-cache
    uses: actions/cache@v3
    with:
    path: ${{ inputs.cwd }}.yarn/ci-cache
    key: yarn-install-state-cache-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ steps.yarn-config.outputs.CURRENT_BRANCH }}-${{ hashFiles('yarn.lock', '.yarnrc.yml') }}
    path: ${{ inputs.cwd }}/.yarn/ci-cache
    key: yarn-install-state-cache-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ steps.yarn-config.outputs.CURRENT_BRANCH }}-${{ hashFiles(format('{0}/yarn.lock', inputs.cwd), format('{0}/.yarnrc.yml', inputs.cwd)) }}

    - name: 📥 Install dependencies
    shell: bash
    @@ -122,6 +122,7 @@ runs:
    YARN_INSTALL_STATE_PATH: '.yarn/ci-cache/install-state.gz' # Might speed up resolution step when node_modules present
    # Other environment variables
    HUSKY: '0' # By default do not run HUSKY install

    ```

    ### Workflow action
  29. belgattitude revised this gist May 6, 2023. 1 changed file with 9 additions and 12 deletions.
    21 changes: 9 additions & 12 deletions ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -39,7 +39,7 @@ Create a file in `.github/actions/yarn-nm-install/action.yml` and paste
    # enable-corepack: false # (default) #
    # cache-install-state: false # (default) #
    # cache-node-modules: false # (default) #
    # cwd: ${{ github.workspace }} # (default = '.') #
    # cwd: ${{ github.workspace/apps/strapi }} # (default = '.') #
    # #
    # Reference: #
    # - latest: https://gist.github.com/belgattitude/042f9caf10d029badbde6cf9d43e400a #
    @@ -76,14 +76,14 @@ runs:
    run: corepack enable

    - name: ⚙️ Expose yarn config as "$GITHUB_OUTPUT"
    id: yarn-config
    id: yarn-config
    shell: bash
    working-directory: ${{ inputs.cwd }}
    env:
    YARN_ENABLE_GLOBAL_CACHE: "false"
    YARN_ENABLE_GLOBAL_CACHE: 'false'
    run: |
    echo "CACHE_FOLDER=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
    echo "CURRENT_NODE_VERSION="node-$(node --version)" >> $GITHUB_OUTPUT
    echo "CURRENT_NODE_VERSION="node-$(node --version)"" >> $GITHUB_OUTPUT
    echo "CURRENT_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's,/,-,g')" >> $GITHUB_OUTPUT
    - name: ♻️ Restore yarn cache
    @@ -99,18 +99,16 @@ runs:
    if: inputs.cache-node-modules == 'true'
    id: yarn-nm-cache
    uses: actions/cache@v3
    working-directory: ${{ inputs.cwd }}
    with:
    path: '**/node_modules'
    path: ${{ inputs.cwd }}/**/node_modules
    key: yarn-nm-cache-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ steps.yarn-config.outputs.CURRENT_BRANCH }}-${{ hashFiles('yarn.lock', '.yarnrc.yml') }}

    - name: ♻️ Restore yarn install state
    if: inputs.cache-install-state == 'true' && inputs.cache-node-modules == 'true'
    id: yarn-install-state-cache
    uses: actions/cache@v3
    working-directory: ${{ inputs.cwd }}
    with:
    path: .yarn/ci-cache
    path: ${{ inputs.cwd }}.yarn/ci-cache
    key: yarn-install-state-cache-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ steps.yarn-config.outputs.CURRENT_BRANCH }}-${{ hashFiles('yarn.lock', '.yarnrc.yml') }}

    - name: 📥 Install dependencies
    @@ -119,12 +117,11 @@ runs:
    run: yarn install --immutable --inline-builds
    env:
    # Overrides/align yarnrc.yml options (v3, v4) for a CI context
    YARN_ENABLE_GLOBAL_CACHE: "false" # Use local cache folder to keep downloaded archives
    YARN_NM_MODE: "hardlinks-local" # Reduce node_modules size
    YARN_INSTALL_STATE_PATH: ".yarn/ci-cache/install-state.gz" # Might speed up resolution step when node_modules present
    YARN_ENABLE_GLOBAL_CACHE: 'false' # Use local cache folder to keep downloaded archives
    YARN_NM_MODE: 'hardlinks-local' # Reduce node_modules size
    YARN_INSTALL_STATE_PATH: '.yarn/ci-cache/install-state.gz' # Might speed up resolution step when node_modules present
    # Other environment variables
    HUSKY: '0' # By default do not run HUSKY install

    ```
    ### Workflow action
  30. belgattitude revised this gist May 6, 2023. 1 changed file with 12 additions and 4 deletions.
    16 changes: 12 additions & 4 deletions ci-yarn-install.md
    Original file line number Diff line number Diff line change
    @@ -39,6 +39,7 @@ Create a file in `.github/actions/yarn-nm-install/action.yml` and paste
    # enable-corepack: false # (default) #
    # cache-install-state: false # (default) #
    # cache-node-modules: false # (default) #
    # cwd: ${{ github.workspace }} # (default = '.') #
    # #
    # Reference: #
    # - latest: https://gist.github.com/belgattitude/042f9caf10d029badbde6cf9d43e400a #
    @@ -59,7 +60,10 @@ inputs:
    description: 'Cache yarn install state, might speed up resolution step when node-modules cache is activated (invalidated lock/os/node-version/branch)'
    required: false
    default: 'false'

    cwd:
    description: "Changes node's process.cwd() if the project is not located on the root. Default to process.cwd()"
    required: false
    default: '.'

    runs:
    using: 'composite'
    @@ -68,16 +72,18 @@ runs:
    - name: ⚙️ Enable Corepack
    if: ${{ inputs.enable-corepack }} == 'true'
    shell: bash
    working-directory: ${{ inputs.cwd }}
    run: corepack enable

    - name: ⚙️ Expose yarn config as "$GITHUB_OUTPUT"
    id: yarn-config
    id: yarn-config
    shell: bash
    working-directory: ${{ inputs.cwd }}
    env:
    YARN_ENABLE_GLOBAL_CACHE: "false"
    run: |
    echo "CACHE_FOLDER=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
    echo "CURRENT_NODE_VERSION="node-$(node --version | cut -d . -f 1 | sed 's/[^0-9]*//g')".x" >> $GITHUB_OUTPUT
    echo "CURRENT_NODE_VERSION="node-$(node --version)" >> $GITHUB_OUTPUT
    echo "CURRENT_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's,/,-,g')" >> $GITHUB_OUTPUT
    - name: ♻️ Restore yarn cache
    @@ -93,6 +99,7 @@ runs:
    if: inputs.cache-node-modules == 'true'
    id: yarn-nm-cache
    uses: actions/cache@v3
    working-directory: ${{ inputs.cwd }}
    with:
    path: '**/node_modules'
    key: yarn-nm-cache-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ steps.yarn-config.outputs.CURRENT_BRANCH }}-${{ hashFiles('yarn.lock', '.yarnrc.yml') }}
    @@ -101,12 +108,14 @@ runs:
    if: inputs.cache-install-state == 'true' && inputs.cache-node-modules == 'true'
    id: yarn-install-state-cache
    uses: actions/cache@v3
    working-directory: ${{ inputs.cwd }}
    with:
    path: .yarn/ci-cache
    key: yarn-install-state-cache-${{ runner.os }}-${{ steps.yarn-config.outputs.CURRENT_NODE_VERSION }}-${{ steps.yarn-config.outputs.CURRENT_BRANCH }}-${{ hashFiles('yarn.lock', '.yarnrc.yml') }}

    - name: 📥 Install dependencies
    shell: bash
    working-directory: ${{ inputs.cwd }}
    run: yarn install --immutable --inline-builds
    env:
    # Overrides/align yarnrc.yml options (v3, v4) for a CI context
    @@ -116,7 +125,6 @@ runs:
    # Other environment variables
    HUSKY: '0' # By default do not run HUSKY install


    ```

    ### Workflow action