summaryrefslogtreecommitdiff
path: root/.gitlab-ci
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2020-11-04 18:44:01 +0100
committerJonas Ådahl <jadahl@gmail.com>2020-11-16 14:12:48 +0100
commite7b126eb59028c1e3d88979026d5e235318990f5 (patch)
tree210d6e9f1bcb9ceab48540c11365bfa26688e6a0 /.gitlab-ci
parent86f02c758bdaa3ba7c5d3dd4dbad8a4c897a28ae (diff)
downloadmutter-e7b126eb59028c1e3d88979026d5e235318990f5.tar.gz
ci/check-commit-log: Inverse merge request URL check
It's from now on the responsibility of marge-bot to append merge request urls to commit messages, so they should not be part of the commit message itself. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1549>
Diffstat (limited to '.gitlab-ci')
-rwxr-xr-x.gitlab-ci/check-commit-log.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/.gitlab-ci/check-commit-log.sh b/.gitlab-ci/check-commit-log.sh
index 83118ad67..c7ca1b106 100755
--- a/.gitlab-ci/check-commit-log.sh
+++ b/.gitlab-ci/check-commit-log.sh
@@ -16,10 +16,10 @@ if [ -z "$commits" ]; then
exit 1
fi
-function commit_message_has_url() {
+function commit_message_has_mr_url() {
commit=$1
commit_message=$(git show -s --format='format:%b' $commit)
- echo "$commit_message" | grep -qe "\($CI_MERGE_REQUEST_PROJECT_URL/\(-/\)\?\(issues\|merge_requests\)/[0-9]\+\|https://bugzilla.gnome.org/show_bug.cgi?id=[0-9]\+\)"
+ echo "$commit_message" | grep -qe "^$CI_MERGE_REQUEST_PROJECT_URL\/\(-\/\)\?merge_requests\/$CI_MERGE_REQUEST_IID$"
return $?
}
@@ -54,8 +54,8 @@ RET=0
for commit in $commits; do
commit_short=$(echo $commit | cut -c -8)
- if ! commit_message_has_url $commit; then
- echo "Commit $commit_short needs a merge request or issue URL"
+ if commit_message_has_mr_url $commit; then
+ echo "Commit $commit_short must not contain a link to its own merge request"
exit 1
fi