netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

Try to validate commit headers.

Open mbien opened this issue 2 years ago • 4 comments

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:

image

output in job log:

image

mbien avatar Oct 28 '23 00:10 mbien

well late :D will need rebase.

ebarboni avatar Sep 26 '24 13:09 ebarboni

rebased, removed string templates and fixed a bug

mbien avatar Sep 26 '24 14:09 mbien

LGTM

ebarboni avatar Sep 27 '24 09:09 ebarboni

removed the test commits and updated the error messages a bit

mbien avatar Sep 27 '24 20:09 mbien

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

mbien avatar Nov 03 '24 22:11 mbien

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.

mbien avatar Nov 04 '24 21:11 mbien

updates:

mbien avatar Nov 22 '24 04:11 mbien

added a few examples for regression testing, planning to merge this soon

mbien avatar Nov 22 '24 18:11 mbien