Skip to content

Problem with yarn v4.14 config approvedGitRepositories #1534

@dimaslanjaka

Description

@dimaslanjaka

Description:
Yarn requires config approvedGitRepositories for fetching packages from repositories. e.g:

approvedGitRepositories:
  ['https://github.com/yarnpkg/*', 'ssh://git@github.com/yarnpkg/*', 'https://github.com/dimaslanjaka/*']

when i put approvedGitRepositories to .yarnrc.yml, actions/setup-node@v6 will throw error

Run actions/setup-node@v6
Found in cache @ /opt/hostedtoolcache/node/20.20.2/x64
Environment details
/usr/local/bin/yarn --version
/usr/local/bin/yarn --version
/usr/local/bin/yarn --version
/usr/local/bin/yarn --version
/usr/local/bin/yarn --version
/usr/local/bin/yarn --version
/usr/local/bin/yarn --version
/usr/local/bin/yarn --version
/usr/local/bin/yarn --version
/usr/local/bin/yarn --version
/usr/local/bin/yarn --version
4.14.1
/usr/local/bin/yarn config get cacheFolder
4.14.1
3.5.1
4.14.1
/usr/local/bin/yarn config get cacheFolder
3.4.1
/usr/local/bin/yarn config get cacheFolder
4.14.1
4.14.1
/usr/local/bin/yarn config get cacheFolder
/usr/local/bin/yarn config get cacheFolder
4.14.1
4.14.1
/usr/local/bin/yarn config get cacheFolder
/usr/local/bin/yarn config get cacheFolder
4.14.1
4.14.1
/usr/local/bin/yarn config get cacheFolder
/usr/local/bin/yarn config get cacheFolder
/usr/local/bin/yarn config get cacheFolder
/usr/local/bin/yarn config get cacheFolder
/home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/.yarn/cache
Usage Error: Unrecognized or legacy configuration settings found: approvedGitRepositories - run "yarn config -v" to see the list of settings supported in Yarn (in /home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/.yarnrc.yml)

$ yarn config get [--json] [--no-redacted] <name>
Usage Error: Unrecognized or legacy configuration settings found: approvedGitRepositories - run "yarn config -v" to see the list of settings supported in Yarn (in /home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/.yarnrc.yml)

$ yarn config get [--json] [--no-redacted] <name>
/home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/.yarn/cache
Error: The 'yarn config get cacheFolder' command failed with exit code: 1
/home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/.yarn/cache
/home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/.yarn/cache
/home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/.yarn/cache
/home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/.yarn/cache
/home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/.yarn/cache
/home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/.yarn/cache
/home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/.yarn/cache

when i remove approvedGitRepositories, got another error on other step

Run yarn cache clean --all
➤ YN0000: Done in 0s 4ms
Some packages are missing: gulp, glob, sbg-utility, upath, fs-extra
Running yarn install...
➤ YN0000: · Yarn 4.14.1
➤ YN0000: ┌ Resolution step
Resolution step
➤ YN0080: @types/through2@https://github.com/dimaslanjaka/nodejs-package-types/tarball/through2: Request to 'https://github.com/dimaslanjaka/nodejs-package-types.git' has been blocked because it doesn't match any of the patterns in 'approvedGitRepositories'
➤ YN0000: └ Completed in 10s 690ms
➤ YN0000: · Failed with errors in 10s 706ms
node:internal/modules/esm/resolve:873
  throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
        ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'fs-extra' imported from /home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/setup.mjs
    at packageResolve (node:internal/modules/esm/resolve:873:9)
    at moduleResolve (node:internal/modules/esm/resolve:946:18)
    at defaultResolve (node:internal/modules/esm/resolve:1188:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:708:12)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:657:25)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:640:38)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:264:38)
    at ModuleLoader.import (node:internal/modules/esm/loader:605:34)
    at defaultImportModuleDynamicallyForModule (node:internal/modules/esm/utils:221:31)
    at importModuleDynamicallyCallback (node:internal/modules/esm/utils:260:12) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Action version:
v6

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:

yarn version 4.14.1
System:
    OS: Windows 10 10.0.19045
    CPU: (4) x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
  Binaries:
    Node: 22.17.1 - C:\Users\Dell\AppData\Local\Temp\xfs-b20f392a\node.CMD
    Yarn: 4.14.1 - C:\Users\Dell\AppData\Local\Temp\xfs-b20f392a\yarn.CMD
    npm: 11.11.1 - C:\nvm4w\nodejs\npm.CMD

Repro steps:
https://github.com/dimaslanjaka/static-blog-generator-hexo
https://github.com/dimaslanjaka/static-blog-generator-hexo/blob/3e4631dc501b9dc8e881919d75ed127df65aeabb/.github/workflows/build-site.yml

Linked issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions