palantir / palantir-java-format

A modern, lambda-friendly, 120 character Java formatter.
Apache License 2.0
403 stars 43 forks source link

[Feature] Support GitHub Action #1072

Open godruoyi opened 2 months ago

godruoyi commented 2 months ago

What happened?

I really like this tool, it is much more useful than Google Java format. I have searched our documents and code but did not find how to integrate into github action. Is there any way we can use github action to automatically format the code when we submit it to github?

busches commented 2 months ago

You can use the standard java action with maven and run mvn spotless:apply, see here for more examples on setting that up: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven