How to let Jenkins git commit only if there are changes?

I have a Jenkins job that builds from a github.com repository's master branch with Maven (mvn clean install), then checks for license headers in Java files and missing NOTICE files, and adds them if