Code Monkey home page Code Monkey logo

Comments (9)

creyD avatar creyD commented on July 3, 2024 12

Alright, there is now v4.3 which has the bugfix and a note for the workaround in the readme. Thanks for everyone who hel'ped and supported here! All repos using the action with the @master or just plain prettier_action without a version specified don't need to change anything. Everyone else who pinned an earlier version should either change their workflow to the new version or add the workaround.

from prettier_action.

WilliamsCJ avatar WilliamsCJ commented on July 3, 2024 5

Version 3.3 appears to be the latest version that is not affected.

from prettier_action.

semseysandor avatar semseysandor commented on July 3, 2024 2

A workaround for this bug: pin npm to version 8 in your job (if it's possible)

- name: Install npm v8
  run: npm i -g npm@8

- name: Check code-style
  uses: creyD/[email protected]
  with:
    dry: true
    prettier_options: --check **/*.{md,yml}

from prettier_action.

creyD avatar creyD commented on July 3, 2024 2

Hi all! Thanks for the quick and efficient coordination. As I can see you already worked out a workaround. I can also add it to the readme to support struggling users. Would it be a good idea to pin the npm version in the action? Or what ways forward should we think of?

from prettier_action.

semseysandor avatar semseysandor commented on July 3, 2024 1

I've done some debugging:

  • it seems prettier is not found because $PATH is off:
    echo PATH=$PATH
    PATH=Unknown command: "bin"
    
    To see a list of supported npm commands, run:
      npm help:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
    
  • running npm help confirms npm bin is not available
    npm <command>
    
    Usage:
    
    npm install        install all the dependencies in your project
    npm install <foo>  add the <foo> dependency to your project
    npm test           run this project's tests
    npm run <foo>      run the script named <foo>
    npm <command> -h   quick help on <command>
    npm -l             display usage info for all commands
    npm help <term>    search for help on <term>
    npm help npm       more involved overview
    
    All commands:
    
        access, adduser, audit, bugs, cache, ci, completion,
        config, dedupe, deprecate, diff, dist-tag, docs, doctor,
        edit, exec, explain, explore, find-dupes, fund, get, help,
        hook, init, install, install-ci-test, install-test, link,
        ll, login, logout, ls, org, outdated, owner, pack, ping,
        pkg, prefix, profile, prune, publish, query, rebuild, repo,
        restart, root, run-script, search, set, shrinkwrap, star,
        stars, start, stop, team, test, token, uninstall, unpublish,
        unstar, update, version, view, whoami
    
    Specify configs in the ini-formatted file:
        /home/runner/.npmrc
    or on the command line via: npm <command> --key=value
    
    More configuration info: npm help config
    Configuration fields: npm help 7 config
    
    [email protected] /usr/local/lib/node_modules/npm
    
  • check npm version
    npm version
    9.3.1
    
  • In npm 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-changes
  • $PATH is set by npm bin in
    PATH=$(cd $GITHUB_ACTION_PATH; npm bin):$PATH

Conclusion

It seems currently this action won't work with npm v9.
So 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 though 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 😃

from prettier_action.

shawnyu5 avatar shawnyu5 commented on July 3, 2024

Same here, workflows using this actions randomly started failing recently with the same error /home/runner/work/_actions/creyD/prettier_action/v4.2/entrypoint.sh: line 74: prettier: command not found

from prettier_action.

infotexture avatar infotexture commented on July 3, 2024

Same here: https://github.com/dita-ot/docs/actions/runs/4211604746/jobs/7310061348

from prettier_action.

Piet2001 avatar Piet2001 commented on July 3, 2024

Here the same issue in multile repo's.

from prettier_action.

Viicos avatar Viicos commented on July 3, 2024

Would it be a good idea to pin the npm version in the action? Or what ways forward should we think of?

I think it's a good practice to pin versions when possible, so that the behavior will always be the same. Then when something gets an update, it can be manually updated on the action, making sure that everything's working as excepted

from prettier_action.

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.