Closed andresgutgon closed 1 year ago
Ok I found what was my issue.
This line is looking always in the root of the repo: https://github.com/pnpm/action-setup/blob/11dd14d0c0916e1ad9ff1938d8d4ea509bebfe10/src/install-pnpm/run.ts#L47
The solution was to use version
param:
- name: Setup pnpm
uses: pnpm/action-setup@v2.2.4
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 : )
Is there a fix without pinning the version to 7.x.x?
Mine is not a fix pinning to any specific version. In version
you can put whatever:
- name: Setup pnpm
uses: pnpm/action-setup@v2.2.4
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.
Doesn't this mean that it pins the version...?! https://github.com/pnpm/action-setup#version
Sorry if I'm being dumb.
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.
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?
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
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!
@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
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
WHAT?
Hi, I'm trying to use this GitHub Action in a project that looks like this:
I want to use
pnpm
insidemyproject/client/package.json
folder but this action:It's giving this error:
Specify destination
I also tried setting destination. But I get the same error.
I would appreciate any help. Thanks!