taplo icon indicating copy to clipboard operation
taplo copied to clipboard

feat(action): add github action for cargo.toml formating

Open gwen-lg opened this issue 6 months ago • 16 comments

Note: this is a first version for comments

It's great to have Cargo.toml (by example) formatted on save in VSCode. But If it's not checked in CI, this is dependent of developer use Even Better TOML and process.

TODO:

  • manage config with indent_string=" " for Cargo.toml (like Even Better TOML)
  • convert output to display beautiful error/warning in github
  • feature for allow automatic patch commits ?

#470

Work inspired from https://github.com/marketplace/actions/typos-action

gwen-lg avatar May 17 '25 20:05 gwen-lg

Taplo is already usable in GHA via uses: docker://tamasfe/taplo

panekj avatar May 25 '25 14:05 panekj

Why not https://autofix.ci?

JounQin avatar May 25 '25 15:05 JounQin

Why not autofix.ci?

Maybe someone doesn't want to pay for it?

panekj avatar May 25 '25 16:05 panekj

Maybe someone doesn't want to pay for it?

Hah, isn't it free?

JounQin avatar May 25 '25 23:05 JounQin

Maybe someone doesn't want to pay for it?

Hah, isn't it free?

Not for private repos

panekj avatar May 26 '25 00:05 panekj

Not for private repos

How is it related to private repos here?

JounQin avatar May 26 '25 00:05 JounQin

You brought up autofix.ci?

panekj avatar May 26 '25 00:05 panekj

You brought up autofix.ci?

But taplo is not a private repo?

JounQin avatar May 26 '25 00:05 JounQin

And the PR isn't about using taplo for taplo repository. You're suggesting using autofix.ci for something, I don't know what. The PR adds GitHub actions for uing taplo in GHA which can be used in public repos, private repos, GHES, whatever.

panekj avatar May 26 '25 00:05 panekj

And the PR isn't about using taplo for taplo repository. You're suggesting using autofix.ci for something, I don't know what. The PR adds GitHub actions for uing taplo in GHA which can be used in public repos, private repos, GHES, whatever.

Sorry I misunderstood what this PR does. :(

JounQin avatar May 26 '25 01:05 JounQin

Taplo is already usable in GHA via uses: docker://tamasfe/taplo

Do you prefer a GitHub Action based on docker image, instead of release files ?

I found no documentation about how to use taplo in GitHub Workflow. So a dedicated GitHub Action might be helpful to users.

gwen-lg avatar May 26 '25 12:05 gwen-lg

Docker-based actions are not available for macos and windows (based on https://docs.github.com/en/actions/sharing-automations/creating-actions/about-custom-actions#types-of-actions)

tobiasdiez avatar May 26 '25 12:05 tobiasdiez

If it's going to be action then it should just run taplo, adding commands checking and file arguments is super awkward when the configuration is supposed to live in /taplo.toml (or /.taplo.toml)

- uses: taplo
  with:
    format: true/false
    lint: true/false

panekj avatar May 26 '25 13:05 panekj

Although I think I'd prefer it to be in NodeJS and not shell

panekj avatar May 26 '25 13:05 panekj

If it's going to be action then it should just run taplo, adding commands checking and file arguments is super awkward when the configuration is supposed to live in /taplo.toml (or /.taplo.toml)

- uses: taplo
  with:
    format: true/false
    lint: true/false

I'm ok with this, I can update action in this direction.

Although I think I'd prefer it to be in NodeJS and not shell

I am not against it, but I haven't the knowledge to do this. So unless it's really simple and has examples to guide me, someone else will have to do it.

gwen-lg avatar May 26 '25 13:05 gwen-lg

@panekj : I have updated with simpler version. I have keep the setup of version, and format_write_changes this second can also be removed if it's preferred. I have add a small part for doc in README.md, I haven't take time to create a page in website documentation, perhaps it's better/or complementary to README.md.

gwen-lg avatar May 26 '25 15:05 gwen-lg