Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ if [[ -n "$MERGED_BRANCHES" ]]; then
IFS=',' read -ra BRANCHES <<< "$MERGED_BRANCHES"
for branch in "${BRANCHES[@]}"; do
# Trim leading/trailing whitespace from branch name
branch=$(echo "$branch" | xargs)
branch="${branch#"${branch%%[![:space:]]*}"}"
branch="${branch%"${branch##*[![:space:]]}"}"
while IFS= read -r key; do
JIRA_KEYS+=("$key")
done < <(echo "$branch" | grep -oE '[A-Z0-9]+-[0-9]+')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,18 @@ teardown() {
[ "$status" -eq 0 ]
[ "$(grep '^issue_keys=' "$GITHUB_OUTPUT" | cut -d= -f2)" = "PROJ25-123,PROJ25-456" ]
}

@test "extract-issue-keys: handles single quotes" {
run "$BATS_TEST_DIRNAME/../scripts/extract-issue-keys.sh" "Merge remote-tracking branch 'origin/develop, feature/PROJ-1011-eaa-login, futuredapp/feature/PROJ-1009-eaa-intro"

[ "$status" -eq 0 ]
[ "$(grep '^issue_keys=' "$GITHUB_OUTPUT" | cut -d= -f2)" = "PROJ-1009,PROJ-1011" ]
}

@test "extract-issue-keys: handles double quotes" {
run "$BATS_TEST_DIRNAME/../scripts/extract-issue-keys.sh" "Merge remote-tracking branch 'origin/develop', feature/PROJ-1011-eaa-login, futuredapp/feature/PROJ-1009-eaa-intro"

[ "$status" -eq 0 ]
[ "$(grep '^issue_keys=' "$GITHUB_OUTPUT" | cut -d= -f2)" = "PROJ-1009,PROJ-1011" ]
}