-#!/bin/sh
+#!/bin/bash
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+set -e
+echo "Launching tox"
+tox --parallel=auto
+
+echo "Checking the presence of release notes ..."
+
+nb_rn=$(git diff --diff-filter=A --name-only HEAD~1 |grep "releasenotes\/notes" |wc -l)
+if [ "${nb_rn}" -lt 1 ]; then
+ echo "The commit needs release notes"
+ echo "Run the following command to generate release notes: tox -e release_notes '<release_note_title>'"
+ echo "Please read README.md for more details"
+ exit 1
+elif [ "${nb_rn}" -gt 1 ]; then
+ echo "Only one release notes file should be added in a commit"
+ exit 1
+fi
+
+echo "OK. Release notes present in commit"
-echo launching tox
-OUTPUT=$(TOX_PARALLEL_NO_SPINNER=1 tox --parallel=auto)
-printf "$OUTPUT"