Skip to content

[FEATURE] Show diff after failure #96

@jakeboone02

Description

@jakeboone02

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions