Our commit messages do have to have a specific structure to be allowed to pass:
INSPECTIT-XXX[, INSPECTIT-XXX]*: <message>
This needs to be checked in the pull request and integration build so that people get notified immediately that this needs to be changed.
My point with multiple commits still isn't handled. Thus I would leave it open.
I've had a closer look at this and set up a dummy repository for testing. I'm not sure about the GitHub process but as far as I can see, GitHub creates a new (, hidden?) commit for a pull-request (see attached image).
If we can take the assumption that a pull-request consists of an "one-line commit tree" (no merged commits) we can use the following command to fetch the commit messages:
Here, all commits are shown which are created since the master branch. The "--no-merges" flag prevents printing the "merge ... into ..." commit from GitHub.
Complete script would be:
Now, all commit messages of the current branch will be verified.
the problem with this commit message won't happen in Jenkins as there is one shell script before, which is executing a rebase. And this rebase removes this commit which you see there. The problem with the script before was, that it explicitely used the commit passed in (the variable) and thus it didn't use the final result of the rebase. Either way, you can use the --no-merges if you want. Would be bullet-proof then .
I'm sorry that I'm responding very late to that comment.
The script is completed from my side and already integrated into the Jenkins jobs 'Pull Request Check' and 'Integration'.
I'm using the mentioned "--no-merges" flag to receive the commit messages.
The integrated script is identical with the script posted in my previous post (maybe we can move it to a proper confluence site).
The only difference is that the building branch is compared to the stable and not to the master branch (which will be build) during the 'Integration job'.
Command in the 'Pull-Request Job':
Command in the 'Integration Job':
The script works fine in the 'Pull-Request Job' but I've could not tested it on the 'Integration Job'.
Closing as it's finished and tested in both jobs.