-
-
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. - Title consists of module name(s) and subject or just subject. - If there are two or more module names, the module names has to be separated by a comma followed by an optional space. - First word of the subject is starting from an upper case letter and remaining characters in the first word are lower case letters. - The subject is 72 characters at max excluding module prefix. If the title exceed 50 characters, display a warning message. - Titles for commits of revert and merge are ignored. - Full description lines are 72 columns max.
- Loading branch information
Showing
2 changed files
with
97 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 FETCH_HEAD.. | ./CI/check-log-msg.awk -v GITHUB_EVENT_NAME=${{env.GITHUB_EVENT_NAME}} |
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,79 @@ | ||
#! /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 "Info: not frequently appearing module name: "mod | ||
} | ||
|
||
state==3 && !is_merge { | ||
title = gensub(/^ */, "", 1, $0) | ||
if (title ~ /^Revert ".*"$/) { | ||
next | ||
} | ||
if (title ~ /^Merge [0-9a-f]{40} into [0-9a-f]{40}$/) { | ||
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) > 72) { | ||
print "Error: commit "commit": too long title: "title | ||
ret = 1 | ||
} | ||
else if (length(title1) > 50) { | ||
print "Warning: commit "commit": long title: "title | ||
} | ||
} | ||
|
||
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) | ||
} |