Skip to content

Commit

Permalink
TEST: PR Template and check commit title
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergei-Lebedev committed Oct 23, 2020
1 parent b790f35 commit f79897b
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
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._
53 changes: 53 additions & 0 deletions .github/workflows/codestyle.yaml
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

0 comments on commit f79897b

Please sign in to comment.