Visitar URL original
Add `cargo fmt --all` and commit to github action · Issue #6204 · RustPython/RustPython · GitHub
Skip to content

Add cargo fmt --all and commit to github action #6204

Description

@youknowone

Thanks to @YashSuthar983, we now have auto-format after workflows.

I'd like to check if auto-formatting before workflows is possible

Summary

This is not a necessary task to be asked to human contributors.
If CI can automatically run it, we can rely on it.

Details

Activity

  1. YashSuthar983 commented on Oct 24, 2025

    @YashSuthar983
    Contributor

    @youknowone i have doubt , as cargo fmt --all formats the code then are we going to make an commit from CI ?

    or we can use cargo fmt --all --check ?

  2. youknowone commented on Oct 26, 2025

    @youknowone
    MemberAuthor

    @YashSuthar983 Make a commit from CI. We already have cargo fmt --check, and the solution is usually running cargo fmt --all and commit the changes. It can be trivially autumated.

  3. YashSuthar983 commented on Oct 26, 2025

    @YashSuthar983
    Contributor

    So what i am thinking is that whenever user open a PR from fork , our CI run cargo fmt --all then if any changes this wil commit to pr of user right?
    I don't think it is allowed by github or we need somthing like bot that use PAT of user for this.

  4. youknowone commented on Oct 26, 2025

    @youknowone
    MemberAuthor

    I didn't try that yet, but some github actions look like supporting it.

    Not sure which one is best fit for this purpose though.

    I can configure some variables on actions if it is required.

  5. YashSuthar983 commented on Oct 26, 2025

    @YashSuthar983
    Contributor

    @youknowone We can do one thing, whenever a user pushes to their fork, the CI pipeline run cargo fmt --all and if any formatting changes are needed, it should commit in their fork itself.
    i tested this in repo. see pull request
    if this satisfy need let me know ?

  6. YashSuthar983 commented on Oct 28, 2025

    @YashSuthar983
    Contributor

    @youknowone I’d like to know your thoughts on the solution, as it’s a hassle to remind everyone to run cargo fmt --all each time.

  7. youknowone commented on Oct 29, 2025

    @youknowone
    MemberAuthor

    @YashSuthar983 I checked the repository and it is looking great! Could you apply the same workflow to RustPython too?

  8. YashSuthar983 commented on Oct 30, 2025

    @YashSuthar983
    Contributor

    @youknowone i got confused as we can do two thing to be efficient and avoid conflicts .

    1. we run auto format at the end of all workflow .
    2. we make separate workflow that you can trigger.
  9. youknowone commented on Oct 30, 2025

    @youknowone
    MemberAuthor

    I expected auto-format before all other workflow, but auto-format at end of workflow also sounds reasonable.

    manual triggering is not a desired one. (better than no auto-format though)

  10. youknowone commented on Nov 14, 2025

    @youknowone
    MemberAuthor

    @YashSuthar983 Thank you so much! it looks working great now

  11. youknowone commented on Nov 14, 2025

    @youknowone
    MemberAuthor
  12. youknowone commented on Nov 25, 2025

    @youknowone
    MemberAuthor

    I tried another way on #6295 . Tested on #6296 and RustPython-test#1
    As you shared, permission mattered. I'd better to try PAT earlier.
    Let's see if it works.

    Thanks @YashSuthar983 and @ShaharNaveh

  13. ShaharNaveh commented on Dec 16, 2025

    @ShaharNaveh
    Contributor

    Closed by #6295

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions