Skip to content

Instantly share code, notes, and snippets.

View valentin-harrang's full-sized avatar

Valentin Harrang valentin-harrang

View GitHub Profile
@valentin-harrang
valentin-harrang / transition-jira-on-open-merge-request.sh
Created September 17, 2024 13:58
Checking for JIRA Ticket in Merge Request Title and updating transition in CI Pipeline
#!/bin/bash
echo "Check if the Merge Request is Draft..."
if [[ "$CI_MERGE_REQUEST_TITLE" =~ "Draft" ]]; then
echo "The Merge Request is in draft. No JIRA action will be taken."
exit 0
fi
echo "Check if the Merge Request title contains a JIRA ticket number..."
if [[ "$CI_MERGE_REQUEST_TITLE" =~ \[(TT-[0-9]+)\] ]]; then
@valentin-harrang
valentin-harrang / transition-jira-on-merge.sh
Last active September 17, 2024 14:00
Detecting JIRA Ticket in Merge Request Title and Executing Transition to ID 3
#!/bin/bash
echo "Verifying if the Merge Request title contains a JIRA ticket number..."
if [[ "$CI_MERGE_REQUEST_TITLE" =~ \[(TT-[0-9]+)\] ]]; then
JIRA_ISSUE="${BASH_REMATCH[1]}"
echo "JIRA ticket number found : ${JIRA_ISSUE}"
else
echo "No JIRA ticket number was found in the Merge Request title."
exit 0 # Do nothing if no ticket is found
fi