pre-commit-ci / issues

public issues for https://pre-commit.ci
17 stars 4 forks source link

Button for "Apply pre-commit changes" #52

Closed kolibril13 closed 3 years ago

kolibril13 commented 3 years ago

Idea

At the moment, pre-commit.ci changes are directly committed to a branch: image To give more control to the user, It might be nice to have an optional button in GitHub called for example "Apply pre-commit changes" , similar to the "Ready for review", or "Update branch" button. image

Motivation

Here is a possible situation where this could be useful and avoid confusion (e.g. assuming that pr-commit includes black formatting).

  1. A contributor writes unformatted code and pushes it to a pull request - branch that has pr-commit.ci enabled.
  2. pre-commit.ci will autoformat and add another commit, but the contributor does not pull the latest changes.
  3. The contributor writes some more unformatted code and makes another commit.
  4. When the contributor tries to push this new commit, there will be a lot of merge conflicts.

With the new button, the code formatting could only be applied at the end of the pull request review process, and there won't be any probably unexpected changes on the branch by the pr-commit.ci bot.

But also without this button pr-commit.ci is already a great feature, especially for auto-formatting the code after applying code changes from the online code suggestion on GitHub.

asottile commented 3 years ago

if the contributor force pushes their changes they won't have a problem (it will reformat their stuff)

that said, I'm currently in the process making this workflow possible:

asottile commented 3 years ago

this is now implemented -- you can do just as I said above !