-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds these checks. - First word is starting from an upper case letter. - The title is 50 characters at max excluding module prefix. - Full description lines are 72 columns max.
- Loading branch information
Showing
2 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Commit Message Check | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
ubuntu64: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Fetch OBS Studio master | ||
run: | | ||
git fetch https://github.com/obsproject/obs-studio.git | ||
- name: Check the log messages | ||
run: | | ||
git log --format=full FETCH_HEAD.. | ./CI/check-log-msg.awk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#! /bin/awk -f | ||
|
||
BEGIN { | ||
ret = 0 | ||
} | ||
|
||
{ | ||
if (/^commit /) { | ||
state = 1 | ||
commit = $2 | ||
is_merge = 0 | ||
} | ||
else if (state==1 && /^$/) state = 2 | ||
else if (state==2) state = 3 | ||
else if (state==3) state = 4 | ||
} | ||
|
||
state==1 && $1=="Merge:" { | ||
is_merge = 1 | ||
} | ||
|
||
function check_module_name(mod) { | ||
if (mod ~ /^(win-capture|rtmp-services|obs-ffmpeg|CI|pipewire):$/) | ||
return | ||
if (mod ~ /^(libobs|deps|docs|UI)(|\/[a-z_-]*):$/) | ||
return | ||
if (mod ~ /^(obs-filters|obs-outputs|win-dshow|cmake|obs-browser):$/) | ||
return | ||
if (mod ~ /^(libobs-opengl|linux-capture|image-source|decklink):$/) | ||
return | ||
if (mod ~ /^(obs-transitions|enc-amf|frontend-tools):$/) | ||
return | ||
print "Warning: not frequently appearing module name: "mod | ||
} | ||
|
||
state==3 && !is_merge { | ||
title = gensub(/^ */, "", 1, $0) | ||
if (title ~ /^Revert ".*"$/) { | ||
next | ||
} | ||
|
||
if (title ~ /^[A-Za-z0-9./-]*(, ?[A-Za-z0-9/-]*)*: /) { | ||
title1 = gensub(/^[^:]*: /, "", 1, title) | ||
mod = $1 | ||
check_module_name(mod) | ||
} else { | ||
title1 = title | ||
mod = "" | ||
} | ||
|
||
split(title1, title_a, / /) | ||
if (title_a[1] !~ /^([A-Z][a-z]*|Don't)$/) { | ||
print "Error: commit "commit": first word: "title_a[1] | ||
ret = 1 | ||
} | ||
|
||
if (length(title1) > 50) { | ||
print "Error: commit "commit": too long title: "title | ||
ret = 1 | ||
} | ||
} | ||
|
||
state==4 { | ||
line = gensub(/^ */, "", 1, $0) | ||
if (length(line) > 72) { | ||
print "Error: commit "commit": too long description in a line: "line | ||
ret = 2 | ||
} | ||
} | ||
|
||
END { | ||
exit(ret) | ||
} |