gitlab-ci.yml: Add check for issue or MR URL

This adds a pipeline stage for merge requests that checks that the
commit message contains an URL to either a issue or a merge request.
This means that for merge requests without corresponding issues will
always fail initially, as the merge request URL is not known until after
it is created. This is still arguably better than accidentally merging
merge requests without URLs.

Taken from https://gitlab.gnome.org/GNOME/mutter/merge_requests/440.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/410
This commit is contained in:
Jonas Ådahl 2019-02-13 20:34:07 +01:00
parent 382282b931
commit 27d0d9f2b3
2 changed files with 33 additions and 0 deletions

View file

@ -1,9 +1,20 @@
stages:
- review
- source_check
variables:
JS_LOG: "js-report.txt"
check_commit_log:
image: registry.fedoraproject.org/fedora:latest
stage: review
before_script:
- dnf install -y git
script:
- ./.gitlab-ci/check-commit-log.sh
only:
- merge_requests
js_check:
image: registry.fedoraproject.org/fedora:latest
stage: source_check
@ -16,3 +27,6 @@ js_check:
paths:
- ${JS_LOG}
when: on_failure
only:
- merge_requests
- /^.*$/