spotless icon indicating copy to clipboard operation
spotless copied to clipboard

GitHub Action that translates spotless apply diff into GitHub pull request code suggestion comments

Open nedtwigg opened this issue 2 years ago • 2 comments

Discussed in https://github.com/diffplug/spotless/discussions/1700

Spotless GitHub Action developed & applied which takes the diff as created through spotless:apply and uses for instance googleapis/code-suggester to create code suggestion comments on the pull request.

This is similar to

  • #655

but that issue is blocked on a few internal enhancements to Spotless. This issue uses spotlessApply to change the files in the working copy, and then generate PR change suggestions from those changes in the working copy. That simplifies the implementation quite a bit, and should be workable with even very old versions of Spotless.

Happy to take a PR for this.

nedtwigg avatar May 17 '23 22:05 nedtwigg

Finally found some time to play around with code-suggester; here's a demo application that runs ./gradlew licenseFormat. When a pull request is opened where that command produces a diff, then the changes are properly suggested on the PR, as seen on https://github.com/timtebeek/code-suggester-action-reproducer/pull/1

I haven't yet worked out what would be needed to gracefully wrap this up as a Spotless GitHub Action, but anyone with more knowledge there is welcome to pitch in. Ideally this makes it as easy as possible to hook into a repository & correct formatting on contributions.

timtebeek avatar Nov 26 '23 16:11 timtebeek

Very cool progress!

nedtwigg avatar Nov 27 '23 05:11 nedtwigg