diff --git a/scripts/inform_codeowners.sh b/scripts/inform_codeowners.sh index 6d27d5d0a88a45e3d19fafa4506f00e8a61be7a5..42472a18baeb2137dd1ff5ef629c5f23722dc1ba 100755 --- a/scripts/inform_codeowners.sh +++ b/scripts/inform_codeowners.sh @@ -151,6 +151,14 @@ function generate_file_list() { function generate_comment() { + # Fail the test if token isn't valid + MRINFO=$(curl -s --request GET --header "PRIVATE-TOKEN: $COMMENT_TOKEN" "https://git.cbm.gsi.de/api/v4/projects/$CI_MERGE_REQUEST_PROJECT_ID/merge_requests/$CI_MERGE_REQUEST_IID") + MRINFO_1=$(echo $MRINFO | grep project_id) + if [[ -z $MRINFO_1 ]]; then + echo "Invalid token. Stop execution" + exit 1 + fi + # Get Information about the MR in JSON format # Check if the returned string contains the signature that the CodeOwners label is set # Only create GitLab comment if there is no comment yet (CodeOwners label not set)