-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Idea: bot that pretty prints on commit #238
Comments
Not crazy, was thinking about a bot for this for |
This is a pretty common idea actually. Various projects make use of their CI for a build step in order to ensure builds are updated properly. For example, the HTML5 Boilerplate has a Travis script that will build it after every change. In fact, @alrra has made a few easy to use scripts to allow branches to be updated (if necessary) from Travis: https://github.com/alrra/travis-scripts. |
Great minds! I think there are three workflows people can choose from:
I think #3 is a really cool idea. We basically need a "last resort" option to make sure everything is formatted. Ideally, a github bot could automatically check PRs and if it detects something isn't formatted it could offer to do a follow-up commit or something like that. I like PRs being completely finished before actually pulling the merge button, and that would give you the chance to squash the format PR in with the others. Can github bots add commits to PRs? |
Can github bots add commits to PRs?
then I think it should be possible if the bot is a collaborator? |
Could it not be just a simple precommit hook that check the staged files ? |
While you could do some pre-commit hook or changing the pull request, it's likely going to be annoying as you are going to change someone else branch, generate merge conflicts... I think the safest approach is to look at master and append a commit that pretty prints whatever files were touched. |
We are using pushing changes from CircleCI back to GreenKeeper PRs because we are using yarn and want the |
I found this but haven't tried it myself yet: https://github.com/GordyD/prettier-master |
@GordyD came up with the idea, he started it before going to parental leave. Not sure what's the current status is. |
Let's close this as we're not going to actively work on it, I still believe it would be great to have though! |
I was thinking in the context of a github project, how to make sure that the files stay pretty printed.
The most obvious way is to add a CI rule that fails if the file is not pretty printed, but in practice that's super annoying as you only get the feedback way later and don't even get an email notification that it failed.
Instead, I was thinking of letting maintainers merge non pretty printed files and then have a CI hook that pretty prints all the changed files. If there's a change, then have a bot commit the pretty printed version to master directly.
Because github doesn't check the author field, we can even have the commit under the original author name and link to the actual commit to make sure that the blame and attribution is clean.
I'd love thoughts on this, is this crazy?
The text was updated successfully, but these errors were encountered: