[gnome-shell/wip/hadess/always-launch-discrete-gpu: 5/6] ci: Also check for project-wide MR and issue references



commit beeac56407ae905ccc7400b4603c8bc91a3e6afa
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Oct 21 13:11:48 2019 +0200

    ci: Also check for project-wide MR and issue references
    
    Allow referencing issues with # and ! rather than only with full URLs.
    
    Closes: #1809

 .gitlab-ci/check-commit-log.sh | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/.gitlab-ci/check-commit-log.sh b/.gitlab-ci/check-commit-log.sh
index cbc48368b2..2308ec07e3 100755
--- a/.gitlab-ci/check-commit-log.sh
+++ b/.gitlab-ci/check-commit-log.sh
@@ -23,9 +23,16 @@ function commit_message_has_url() {
   return $?
 }
 
+function commit_message_has_ref() {
+  commit=$1
+  commit_message=$(git show -s --format='format:%b' $commit)
+  echo "$commit_message" | grep -qe "\([#!][0-9]\+\)"
+  return $?
+}
+
 for commit in $commits; do
-  if ! commit_message_has_url $commit; then
-    echo "Commit $(echo $commit | cut -c -8) needs a merge request or issue URL"
+  if ! commit_message_has_url $commit && ! commit_message_has_ref $commit ; then
+    echo "Commit $(echo $commit | cut -c -8) needs a merge request or issue URL, or a merge request or issue 
number"
     exit 1
   fi
 done


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]