Closed semseysandor closed 1 year ago
Duplicate of https://github.com/creyD/prettier_action/issues/113
A workaround to use this action in your job: pin npm
to version 8
- name: Install npm v8
run: npm i -g npm@8
- name: Check code-style
uses: creyD/prettier_action@v4.2
with:
dry: true
prettier_options: --check **/*.{md,yml}
Duplicate of #113
Oh, yes it is. But here are the reasons also, not just a bug report.
What exactly happened? Steps to reproduce the behavior:
What should've happened? Step should succeed or
prettier
should run at least.Note
I've did some debugging:
it seems
prettier
is not found because$PATH
is off:running
npm help
confirmnpm bin
is not availablenpm v9
npm bin
is removed: https://github.blog/changelog/2022-10-24-npm-v9-0-0-released/#%E2%9A%A0%EF%B8%8F-notable-breaking-changesnpm bin
in https://github.com/creyD/prettier_action/blob/dc62bca389a680b8641b21787af5ab9beba97567/action.yml#L64 it seems this solution won't work withnpm v9
Conclusion
I've executed
prettier
withnpm exec prettier
and it worked, step succeeded. I'm not sure if that's the way. In that casenpm install
might be unneeded as according to the docsnpm exec
can fetch packages also. But I'm not too much into Node and npm so I leave this decision for you :smiley: