Skip to content

Commit e938f60

Browse files
committed
ci(commitlint): check for the presence of concrete PR number (#390)
Enrich commitlint checker in order to check the precise PR number in the commit log headline.
1 parent 7b5f29e commit e938f60

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Check commit message compliance of the pull request
3434
if: github.event_name == 'pull_request'
3535
run: |
36-
./run-tests.sh --check-commitlint ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} ${{ github.event.pull_request.head.sha }}
36+
./run-tests.sh --check-commitlint ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} ${{ github.event.pull_request.head.sha }} ${{ github.event.pull_request.number }}
3737
3838
lint-shellcheck:
3939
runs-on: ubuntu-20.04

run-tests.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ set -o nounset
1212
check_commitlint () {
1313
from=${2:-master}
1414
to=${3:-HEAD}
15+
pr=${4:-[0-9]+}
1516
npx commitlint --from="$from" --to="$to"
1617
found=0
1718
while IFS= read -r line; do
18-
if echo "$line" | grep -qP "\(\#[0-9]+\)$"; then
19+
if echo "$line" | grep -qP "\(\#$pr\)$"; then
1920
true
2021
else
21-
echo "PR number missing in $line"
22+
echo "Headline does not end by '(#$pr)' PR number: $line"
2223
found=1
2324
fi
2425
done < <(git log "$from..$to" --format="%s")

0 commit comments

Comments
 (0)