GithubHelp home page GithubHelp logo

Comments (10)

nicodes avatar nicodes commented on May 26, 2024 2

I found a solution by adding version: 7

- uses: pnpm/action-setup@v2
        with:
          version: 7
          run_install: |
            - cwd: client

However I do think this should be changed in a future version to use the more common syntax working-directory from the defaults like @andresgutgon showed above

from action-setup.

andresgutgon avatar andresgutgon commented on May 26, 2024 1

Yes, in your job:

jobs:
  your_job:
    name: Your job name
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: client

In my case my javascript is in code/client folder

from action-setup.

robotkutya avatar robotkutya commented on May 26, 2024 1

For future reference, you can pin any version and it will work.

Originally I thought you specifically had to pin verison 7.15.0, but any version will do.

@andresgutgon thanks for the tips!

from action-setup.

andresgutgon avatar andresgutgon commented on May 26, 2024

Ok I found what was my issue.

This line is looking always in the root of the repo:

const { packageManager } = JSON.parse(await readFile(path.join(GITHUB_WORKSPACE, 'package.json'), 'utf8'))

The solution was to use version param:

- name: Setup pnpm
  uses: pnpm/[email protected]
  with:
    version: 7.15.0

So this way this action doesn't try to find a package.json in root of the repo.

I hope this can help someone : )

from action-setup.

robotkutya avatar robotkutya commented on May 26, 2024

Is there a fix without pinning the version to 7.x.x?

from action-setup.

andresgutgon avatar andresgutgon commented on May 26, 2024

Mine is not a fix pinning to any specific version. In version you can put whatever:

- name: Setup pnpm
  uses: pnpm/[email protected]
  with:
    version: PUT_YOUR_VERSION

Anyway I was having this problem because I had defined packageManager in my root package.json. Another solution would be not define packageManager attribute in your package.json so you don't need the with config in the action.

from action-setup.

robotkutya avatar robotkutya commented on May 26, 2024

Doesn't this mean that it pins the version...?!
https://github.com/pnpm/action-setup#version

Sorry if I'm being dumb.

from action-setup.

andresgutgon avatar andresgutgon commented on May 26, 2024

I guess if you put a version there that's the version used by the github action. So yes, that would be pinned.

But I think anyway is a good practice to pin your project to an specific pnpm version. Either by setting packageManager in your root package.json or by setting it in the github action.

Anyway what's your problem? Mine was because I had the js monorepo inside a folder of my git repo.

from action-setup.

robotkutya avatar robotkutya commented on May 26, 2024

Okay, gotcha, thanks!

I'm working with a similar setup, do you just add working-directory: foo whenever you run a command or is there a way to take care of that generally?

from action-setup.

nicodes avatar nicodes commented on May 26, 2024

@andresgutgon @robotkutya I'm facing a similar issue, I've read through the docs and I saw run_install.cwd should configure this but I haven't gotten it to work. Does anyone have a working example that we could add to the docs?

Here's a code snippet of what I would expect work based on the docs:

- uses: pnpm/action-setup@v2
        with:
          run_install: |
            - cwd: client

from action-setup.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.