Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Error: Process completed with exit code 1 when using prettier-php #124

Open
rwrj opened this issue Jul 7, 2023 · 12 comments
Open
Labels
bug Something isn't working

Comments

@rwrj
Copy link

rwrj commented Jul 7, 2023

What exactly happened?
Getting this error when running the action: Error: Process completed with exit code 1.
This seems to be happening when initializing the prettier-php plugin

What should've happened?
Prettier should have run successfuly

How did it look?
Here is the full log from the run:-

Run creyD/[email protected]
  with:
    prettier_options: --write **/*.{css,js,php} --print-width 120
    commit_message: Prettier Code Formatting
    prettier_plugins: @prettier/plugin-php
    same_commit: false
    file_pattern: *
    dry: false
    prettier_version: false
    working_directory: false
    only_changed: false
    github_token: ***
    clean_node_folder: true
Run PATH=$GITHUB_ACTION_PATH/node_modules/.bin:$PATH /home/runner/work/_actions/creyD/prettier_action/v4.3/entrypoint.sh
  PATH=$GITHUB_ACTION_PATH/node_modules/.bin:$PATH /home/runner/work/_actions/creyD/prettier_action/v4.3/entrypoint.sh
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    INPUT_COMMIT_MESSAGE: Prettier Code Formatting
    INPUT_COMMIT_DESCRIPTION: 
    INPUT_SAME_COMMIT: false
    INPUT_COMMIT_OPTIONS: 
    INPUT_FILE_PATTERN: *
    INPUT_PRETTIER_OPTIONS: --write **/*.{css,js,php} --print-width 120
    INPUT_DRY: false
    INPUT_PRETTIER_VERSION: false
    INPUT_ONLY_CHANGED: false
    INPUT_PRETTIER_PLUGINS: @prettier/plugin-php
    INPUT_WORKING_DIRECTORY: false
    INPUT_GITHUB_TOKEN: ***
    INPUT_CLEAN_NODE_FOLDER: true
Installing prettier...
Checking plugin: @prettier/plugin-php
Error: Process completed with exit code 1.

Where did you encounter the problem?
When the action ran on making a push.

Here is my full configuration file for reference:-

name: Prettier Code Formatting

on:
  push:
    branches-ignore: [ live ]
#  pull_request:
#    branches-ignore: [ live ]

jobs:
  prettier:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          # Make sure the actual branch is checked out when running on pull requests
          ref: ${{ github.head_ref }}
          # This is important to fetch the changes to the previous commit
          fetch-depth: 0

      - name: Prettify code
        uses: creyD/[email protected]
        with:
          # This part is also where you can pass other options, for example:
          prettier_options: "--write **/*.{css,js,php} --print-width 120"
          commit_message: "Prettier Code Formatting"
          prettier_plugins: "@prettier/plugin-php"
          # only_changed: True
  • Version [4.3]
@rwrj rwrj added the bug Something isn't working label Jul 7, 2023
@rwrj rwrj changed the title [BUG] [BUG] Error: Process completed with exit code 1 when using prettier-php Jul 7, 2023
@rstmsn
Copy link

rstmsn commented Jul 10, 2023

Getting similar issue here, v.4.3.

Run creyD/[email protected]
Run PATH=$GITHUB_ACTION_PATH/node_modules/.bin:$PATH /home/runner/work/_actions/creyD/prettier_action/v4.3/entrypoint.sh
Installing prettier...
Checking plugin: @prettier/plugin-php
Error: Process completed with exit code 1.

@igitur
Copy link

igitur commented Jul 11, 2023

This is caused by breaking changes in prettier v3. Use the prettier_version option to pin the prettier version to 2.x.x.

@igitur
Copy link

igitur commented Jul 11, 2023

Example at https://github.com/cwackerfuss/react-wordle/blob/5f6f622be86c40e8a46c8123cc98c3d6ca8719eb/.github/workflows/lint.yml#L17

@rwrj
Copy link
Author

rwrj commented Jul 11, 2023

This is caused by breaking changes in prettier v3. Use the prettier_version option to pin the prettier version to 2.x.x.

Thanks! It works with Prettier 2.8.8, which was the last version before 3.0.
Do you think this is an issue with prettier or the prettier-php plugin? I can try raising the issue at the appropriate place.

@igitur
Copy link

igitur commented Jul 11, 2023

Run prettier v3 on your own source files first before looking to raise an issue elsewhere.

@malteish
Copy link

malteish commented Aug 2, 2023

Pinning prettier at version 2.8.8 has solved my issues, which looked like this when prettyfying solidity:

Error:  No parser could be inferred for file "[...]".

malteish added a commit to corpus-io/tokenize.it-smart-contracts that referenced this issue Aug 2, 2023
Suddenly, the prettier action started to fail for no aparent reason.
The error message was:

```
Installing prettier...
Checking plugin: prettier-plugin-solidity
Prettifying files...
Files:
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/archive/PersonalInviteOld.sol".
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/archive/PersonalInviteOld.t.sol".
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/contracts/AllowList.sol".
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/contracts/ContinuousFundraising.sol".
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/contracts/FeeSettings.sol".
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/contracts/interfaces/IFeeSettings.sol".
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/contracts/PersonalInvite.sol".
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/contracts/PersonalInviteFactory.sol".
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/contracts/Token.sol".
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/contracts/VestingWalletFactory.sol".
docs/deployment.md 59ms
docs/dev_overview.md 33ms
docs/fees.md 27ms
docs/npm_publishing.md 7ms
docs/price.md 31ms
docs/specification.md 114ms
docs/testing.md 15ms
docs/user_overview.md 45ms
docs/using_the_contracts.md 51ms
LICENSE.md 186ms
README.md 45ms
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/script/CheckToken.sol".
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/script/DeployCompany.sol".
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/script/DeployPlatform.s.sol".
script/hardhatVerifyConstructorArguments/ContinuousFundraising.js 52ms
script/hardhatVerifyConstructorArguments/TokenGoerli.js 3ms
script/hardhatVerifyConstructorArguments/TokenMainnet.js 2ms
script/hardhatVerifyConstructorArguments/VestingWallet.js 3ms
```

It appears prettier v3 introduces some breaking changes, so I pinned
version 2.8.8. See creyD/prettier_action#124
malteish added a commit to corpus-io/tokenize.it-smart-contracts that referenced this issue Aug 17, 2023
Suddenly, the prettier action started to fail for no aparent reason.
The error message was:

```
Installing prettier...
Checking plugin: prettier-plugin-solidity
Prettifying files...
Files:
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/archive/PersonalInviteOld.sol".
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/archive/PersonalInviteOld.t.sol".
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/contracts/AllowList.sol".
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/contracts/ContinuousFundraising.sol".
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/contracts/FeeSettings.sol".
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/contracts/interfaces/IFeeSettings.sol".
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/contracts/PersonalInvite.sol".
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/contracts/PersonalInviteFactory.sol".
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/contracts/Token.sol".
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/contracts/VestingWalletFactory.sol".
docs/deployment.md 59ms
docs/dev_overview.md 33ms
docs/fees.md 27ms
docs/npm_publishing.md 7ms
docs/price.md 31ms
docs/specification.md 114ms
docs/testing.md 15ms
docs/user_overview.md 45ms
docs/using_the_contracts.md 51ms
LICENSE.md 186ms
README.md 45ms
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/script/CheckToken.sol".
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/script/DeployCompany.sol".
Error:  No parser could be inferred for file "/home/runner/work/tokenize.it-smart-contracts/tokenize.it-smart-contracts/script/DeployPlatform.s.sol".
script/hardhatVerifyConstructorArguments/ContinuousFundraising.js 52ms
script/hardhatVerifyConstructorArguments/TokenGoerli.js 3ms
script/hardhatVerifyConstructorArguments/TokenMainnet.js 2ms
script/hardhatVerifyConstructorArguments/VestingWallet.js 3ms
```

It appears prettier v3 introduces some breaking changes, so I pinned
version 2.8.8. See creyD/prettier_action#124
tobyzerner added a commit to tobyzerner/json-api-server that referenced this issue Aug 24, 2023
@rwrj
Copy link
Author

rwrj commented Aug 24, 2023

This worked for a while but now I'm getting the same error again even after pinning Prettier to version 2.8.

Does anyone have any workarounds or suggestions for fixing this?

@igitur
Copy link

igitur commented Aug 24, 2023

@rwrj If your prettier plugins have been updated to support Prettier v3+, then you either have to pin them too, or unpin Prettier. In the end, make sure you know exactly which versions of Prettier and your plugins are running on this Github workflow and using those versions replicate the issue on your localhost. Then you'll know what to do.

@rwrj
Copy link
Author

rwrj commented Aug 24, 2023

@igitur Yes, it's possible that the PHP plugin has been updated. I tried unpinning Prettier but that didn't work either. How can I pin the version of prettier/plugin-php to 0.19.7? This seems to be the last version working with prettier 2.x - https://github.com/prettier/plugin-php/releases/tag/v0.19.7

I'm sorry if this is a silly question but I can't figure out how to set the version of the plugin in the workflow config.

I've tried running this on my localhost and seem to be getting the same error but I'm not sure if I'm doing something else wrong there - I haven't worked much with node / npm before.

@igitur
Copy link

igitur commented Aug 24, 2023

@rwrj Specify the plugin npm package in this format: [email protected]. To be honest, if you haven't used node / npm much before, you should upskill yourself on that first. ChatGPT is a great help.

@rwrj
Copy link
Author

rwrj commented Aug 30, 2023

@igitur I got this set up and the Prettier PHP plugin is working fine on my local machine (Ubuntu 22.04 - which should be the same version being used in the GitHub Action)
It's running Prettier v3.0.3
ChatGPT was a great suggestion, I was struggling getting things to work from the Prettier docs.

Any suggestions on how to proceed from here? Could this possible be an issue with the version of node being run? I see this warning on the GitHub Actions page with the failed run:-
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/

@rwrj
Copy link
Author

rwrj commented Nov 1, 2023

Update: This error seems to be gone now when running on the latest version of Prettier, however it gives the error No parser could be inferred for file "/home/runner/work/.../*.php". for each PHP file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants