I have a Jenkins job that builds from the leading branch of the github.com repository with Maven ( mvn clean install), then checks the license headers in Java files and skips NOTICE files and adds them ( mvn license:format notice:generate) if necessary . Sometimes this leads to the modification or addition of files, sometimes not.
Whenever any changes have been made (license plugin), I want to push the changes to the github registry.
Now it’s hard for me to figure out how best to achieve this. I added the shell build step after the Maven license plugin, where I execute the git commands:
git add .
git commit -m "Added license headers"
git add .works, i.e. does not break the assembly, even if no files are added. However, it git commitbreaks the assembly if there are no changes at all.
I'm not worried about returning to github, as I believe that the post-build git action for publishers can do this for me. Can someone point me in the right direction for git commit?
source
share