diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index eff2a284513d0488cc87080161d07760cf7b7618..fba75a1811bb61f1184f9b4319aad25b63910d5f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,7 +34,7 @@ check_labels: - if: $CI_PIPELINE_SOURCE == "merge_request_event" - when: never script: - - ./scripts/check_labels.sh $CI_MERGE_REQUEST_LABELS + - ./scripts/check_labels.sh $CI_MERGE_REQUEST_LABELS $CI_MERGE_REQUEST_MILESTONE .env: image: paritytech/ci-linux:production diff --git a/scripts/check_labels.sh b/scripts/check_labels.sh index 7316e1087250bc3174e1959efb6e84ab56b6b9bf..8cc8390e71c7e465661c4b83dd154e595f92aa6a 100755 --- a/scripts/check_labels.sh +++ b/scripts/check_labels.sh @@ -6,12 +6,24 @@ RN_LABELS=( RN-silent ) +MR_LABELS=$1 +MR_MILESTONE=$2 + +echo "Labels: $MR_LABELS" +echo "Milestone: $MR_MILESTONE" + +if [[ "$MR_LABELS" == *"RN-runtime"* ]]; then + if [[ "$MR_MILESTONE" != "runtime-"* ]]; then + echo "MR with runtime changes should have a runtime-* milestone." + exit 1 + fi +fi + for RN_LABEL in ${RN_LABELS[@]}; do - if [[ "$1" == *"$RN_LABEL"* ]]; then - echo "exit 0" + if [[ "$MR_LABELS" == *"$RN_LABEL"* ]]; then exit 0 fi done -echo "exit 1" +echo "Every MR should have at least one RN-* label." exit 1