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

[FEATURE] Show diff after failure #96

Open
jakeboone02 opened this issue Sep 15, 2022 · 4 comments
Open

[FEATURE] Show diff after failure #96

jakeboone02 opened this issue Sep 15, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@jakeboone02
Copy link

jakeboone02 commented Sep 15, 2022

What would you like to change about the program?
I'm running this GHA on my react-querybuilder repository. When I run Prettier on my local machines (yarn pretty-print), it makes no changes. But when I push a commit to PR react-querybuilder/react-querybuilder#370 and it runs the Prettier action (which I assumed was running Prettier with the same options/config), I get the following output:

Run creyD/prettier_action@v4.[2](https://github.com/react-querybuilder/react-querybuilder/actions/runs/3056800420/jobs/4931305676#step:5:2)
  with:
    dry: true
    prettier_options: --check *.js examples/**/* packages/*/src/** packages/*/dev/** website/*.js website/{docs,src,versioned_docs,versioned_sidebars}/**
    prettier_version: 2.7.1
    prettier_plugins: prettier-plugin-organize-imports
    commit_message: Prettified Code!
    same_commit: false
    file_pattern: *
    working_directory: false
    only_changed: false
    github_token: ***
  env:
    npm_config_cache: /home/runner/.npm
    GITHUB_TOKEN: ***
Run PATH=$(cd $GITHUB_ACTION_PATH; npm bin):$PATH /home/runner/work/_actions/creyD/prettier_action/v4.2/entrypoint.sh
Installing prettier...
Checking plugin: prettier-plugin-organize-imports
Prettifying files...
Files:
Checking formatting...
[warn] website/src/components/HomepageFeatures.tsx
[warn] website/src/components/QueryBuilderEmbed.tsx
[warn] website/src/pages/index.tsx
[warn] Code style issues found in [3](https://github.com/react-querybuilder/react-querybuilder/actions/runs/3056800420/jobs/4931305676#step:5:3) files. Forgot to run Prettier?
Problem running prettier with --check *.js examples/**/* packages/*/src/** packages/*/dev/** website/*.js website/{docs,src,versioned_docs,versioned_sidebars}/**
Error: Process completed with exit code 1.

I can see that 3 files were changed, but I don't know what was changed. Is there a good way to run git diff after a failed run of this GHA?

Why do you think this is a cool idea?
This may be more of a general GHA question (it's fairly easy to continue to the next step after error) than specific to this action, but it does seem like a useful feature. Maybe a show-changes: true option or something.

Edit: I ended up just running Prettier directly, but I can't figure out what the difference was between that method and running this GHA.

@jakeboone02 jakeboone02 added the enhancement New feature or request label Sep 15, 2022
@AlecRust
Copy link

Seems this is a feature missing in Prettier itself prettier/prettier#6885

@creyD
Copy link
Owner

creyD commented Jan 10, 2023

That's actually strange, maybe some config wasn't picked up by the action? @jakeboone02

Anyways I am not aware of a function like this, but maybe we could add something like this? Either a debug variable or maybe we could run this if prettier fails? Problem at the moment would be that we already stop the action as soon as prettier fails.

@jakeboone02
Copy link
Author

Thanks, @creyD. As I mentioned in the issue description, I think something like show-changes: true or debug-mode: true would be useful. Would you want any assistance? Not sure how much I can do but I'll take a look if you want.

@creyD
Copy link
Owner

creyD commented Jan 11, 2023

@jakeboone02 Thanks for the offer! Always open for PRs or any help, will do my best to respond in a timely manner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants