creyD / prettier_action

GitHub action for running prettier on your projects pull requests
MIT License
276 stars 87 forks source link

[BUG] prettier: command not found #114

Closed semseysandor closed 1 year ago

semseysandor commented 1 year ago

What exactly happened? Steps to reproduce the behavior:

  1. Run prettier_action:
    - name: Check code-style
      uses: creyD/prettier_action@v4.2
      with:
        dry: true
        prettier_options: --check **/*.{md,yml}
  2. Step failed
    Installing prettier...
    Prettifying files...
    /home/runner/work/_actions/creyD/prettier_action/v4.2/entrypoint.sh: line 74: prettier: command not found
    Files:
    Problem running prettier with --check **/*.{md,yml}
    Error: Process completed with exit code 1.

What should've happened? Step should succeed or prettier should run at least.

Note

I've did some debugging:

Conclusion

I've executed prettier with npm exec prettier and it worked, step succeeded. I'm not sure if that's the way. In that case npm install might be unneeded as according to the docs npm exec can fetch packages also. But I'm not too much into Node and npm so I leave this decision for you :smiley:

david-allison commented 1 year ago

Duplicate of https://github.com/creyD/prettier_action/issues/113

semseysandor commented 1 year ago

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}
semseysandor commented 1 year ago

Duplicate of #113

Oh, yes it is. But here are the reasons also, not just a bug report.