Skip to content
Snippets Groups Projects

Fail script in case of invalid token

Merged Florian Uhlig requested to merge f.uhlig/cbmroot:fix_code_owners_script into master
@@ -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)
Loading