Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support cache dependencies for cases where package lock files are located in subfolders #275

Closed
bbugh opened this issue Jun 29, 2021 · 6 comments
Assignees

Comments

@bbugh
Copy link

bbugh commented Jun 29, 2021

Hi! 👋

We have a mixed-language monorepo with nothing in the base folder except some CI info. We need to be able to specify working-directory input like other scripts in order to use this fantastic action to build our node subfolders.

Something like:

- uses: actions/setup-node@v2
  with:
    node-version: '14'
    working-directory: some-client

Thanks!

@maxim-lobanov
Copy link
Contributor

Hello @bbugh , I don't think that you need working-directory input in setup-node task. This task just installs specified Node.js version and do nothing with working directory.

If your package.json / project are located in the separate folder, I think you need to specify working-directory for next steps:

- uses: actions/setup-node@v2
  with:
    node-version: '14'
    
- name: Install dependencies and build project
  working-directory: some-client
  run: |
    npm install
    npm run build
    npm run test

@bbugh
Copy link
Author

bbugh commented Jun 30, 2021

Hi again! 👋 On the caching PR, I had asked about caching working for mono repos, and you had replied saying that's not supported yet. I created this issue to request that support. 😉

Since GitHub actions has poor support for yaml and no reuse between steps, we have a lot of repetitive yarn tasks for caching and running. Having support built into this will be super helpful, and as we have a multi-language mono repo, we need to be able to run and cache them separately.

In particular, Yarn 2's cache folder will be different for each project, as the default is <project>/.yarn and in the case of zero-installs would be committed to source control. In that case, a working-directory would be used to successfully run yarn in the correct location with the correct cache folder.

Or a cache-root option, or something. I suggested working-directory because that's a standard configuration among most actions.

@maxim-lobanov maxim-lobanov changed the title Support working-directory input Support cache dependencies for cases where package lock files are located in subfolders Jun 30, 2021
@maxim-lobanov
Copy link
Contributor

@bbugh caught it. I have renamed the issue title a bit to be more clear. Hope it works for you!

@bbugh
Copy link
Author

bbugh commented Jun 30, 2021

I'm always reminding people about XY problems and here I did one myself. Thanks!

@maxim-lobanov
Copy link
Contributor

Hello everyone!

This feature request will be implemented soon. I have a small ADR under review #299 .
Proposed approach is a bit different from proposed in this issue - we would like allow specifying full path (directory path + filename) to lock file instead of working_directory (directory path only). We believe this approach will be a bit more generic and unblock more use-cases.

@dmitry-shibanov
Copy link
Contributor

Hello everyone, pull request with adding support of specifying lock files was merged. I'm closing the issue if you have any concerns, feel free to reopen it or ping me in the thread.

deining pushed a commit to deining/setup-node that referenced this issue Nov 9, 2023
* feat: add commit_sha output

* docs(README): add docs for commit_sha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants