forked from openucx/ucc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TEST: PR Template and check commit title
- Loading branch information
1 parent
b790f35
commit f79897b
Showing
2 changed files
with
63 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,10 @@ | ||
## What | ||
_Describe what this PR is doing._ | ||
|
||
## Why ? | ||
_Justification for the PR. If there is existing issue/bug please reference. For | ||
bug fixes why and what can be merged in a single item._ | ||
|
||
## How ? | ||
_It is optional but for complex PRs please provide information about the design, | ||
architecture, approach, etc._ |
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,53 @@ | ||
name: Codestyle | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
check-commit-title: | ||
runs-on: ubuntu-latest | ||
name: Check commit title | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Check commit title | ||
run: | | ||
set -eE | ||
range="origin/$GITHUB_BASE_REF..origin/$GITHUB_HEAD_REF" | ||
check_title() { | ||
msg=$1 | ||
if [ ${#msg} -gt 50 ] | ||
then | ||
if ! echo $msg | grep -qP '^Merge' | ||
then | ||
echo "Commit title is too long: ${#msg}" | ||
return 1 | ||
fi | ||
fi | ||
if ! echo $msg | grep -qP '^Merge |^((CORE|UTIL|TEST|API|DOCS)|(CL/|TL/|UCX|UCG))+: \w' | ||
then | ||
echo "Wrong header" | ||
return 1 | ||
fi | ||
if [ "${msg: -1}" = "." ] | ||
then | ||
echo "Dot at the end of title" | ||
return 1 | ||
fi | ||
return 0 | ||
} | ||
ok=1 | ||
for sha1 in `git log $range --format="%h"` | ||
do | ||
title=`git log -1 --format="%s" $sha1` | ||
if check_title "$title" | ||
then | ||
echo "Good commit title: '$title'" | ||
else | ||
echo "Bad commit title: '$title'" | ||
ok=0 | ||
fi | ||
done | ||
if [ $ok -ne 1 ] | ||
then | ||
exit 1 | ||
fi |