Try to validate commit headers.
Back when I setup the paperwork job, I didn't know that gh can generate patch files yet. The problem was to figure out what commits are actually new in the PR. I gave it a few attempts but got distracted with more important things.
this adds:
- simple script to check if all commits have proper email addresses
- looks for empty or single word subject messages
- warns about missing blank lines after subject
- logs errors/warnings to the github actions summary page
output in workflow summary:
output in job log:
well late :D will need rebase.
rebased, removed string templates and fixed a bug
LGTM
removed the test commits and updated the error messages a bit
disabled warnings, kept the errors. Noticed another recent PR (#7776) with invalid mail while testing.
java --enable-preview .github/scripts/CommitHeaderChecker.java https://github.com/apache/netbeans/pull/7776
checking PR patch file...
::error::invalid email in commit 1 'From: Adam Sotona <[email protected]>'
1 commit(s) checked
the stream-gatherers API is final in JDK 24 - I would be available to update the script in the event if any changes are needed. CI JDK for this script is locked to JDK 23 right now and should continue working no matter what so it doesn't create a must-update deadline before our CI breaks.
I think the new single-file-program preview features do make especially sense for CI scripts since CI is very flexible in locking something to specific releases. Risk is close to 0 too. I do also use those CI scripts to actually test (sometimes improve) NetBeans support for them - which is a positive side effect I believe. (e.g https://github.com/apache/netbeans/pull/7605 only happened because of this script)
I the idea, we still need to keep in mind, that this might produce false positives, but that should be rare.
yes, but I am more worried about the opposite case: that it misses cases and committers might start completely relying on it without going through the pre-merge checklist.
updates:
- bots may pass
- looked through history for edge cases and fixed those (e.g.
-as name separator or super long names which cause line wrap) - minor code improvements
added a few examples for regression testing, planning to merge this soon