Closed dicknetherlands closed 1 year ago
Here's the relevant section from my github workflow:
Prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: EPMatt/reviewdog-action-prettier@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-check
level: warning
And here is a sample package.json that triggers the issue:
{
"name": "myproject",
"version": "0.1.0",
"description": "myproject",
"private": true,
"repository": {
"type": "git",
"url": "<censored>"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.4.2",
"react-scripts": "5.0.1",
"typescript": "^4.7.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"pretty": "npx prettier src/** --write",
"prettyver": "npx prettier --version"
},
"devDependencies": {
"prettier": "2.8.4",
"tailwindcss": "^3.2.4"
}
}
This script is broken on npm
version >= 9. It makes use of the npm bin
script which has been removed.
Probably makes sense to update use of $(npm bin)/prettier
to node_modules/.bin/prettier
unless there is a need to really have dynamic resolution.
Hey there,
thank you so much for reporting here. I've just merged #36 (thanks @kazkansouh!) which includes a fix for this issue. If the problem persists, please don't hesitate to open a new ticket.
Thanks!
My package.json contains prettier in devDependencies, version 2.8.4. It runs on ubuntu-latest. At some point in the last week the action started failing with the message below. I tested it by forcing a rerun of the action on a PR that previously worked fine and it failed there too despite there being no subsequent commits.
❌ Unable to locate or install prettier. Did you provide a workdir which contains a valid package.json?
I then tested it further by putting a 'run' step in before the call to uses: reviewdog-action-prettier@v1 in order to force an install of prettier. That installed OK, but the action was still unable to locate it.
It seems that something perhaps in Github or on ubuntu-latest with the "if [-f...]" test has changed that stops this action from functioning correctly?