Skip to content

Commit 68de1f0

Browse files
committed
CCM-9037: normalized branxch name fix
1 parent 8ba6cf2 commit 68de1f0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

.github/actions/normalize-branch-name/action.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@ name: "Normalize branch name"
22
description: "Normalize branch name"
33
outputs:
44
normalized_branch_name:
5+
description: 14 character branch identifier (0000-thebranch)
56
value: ${{ steps.normalize_branch_name.outputs.normalized_branch_name }}
67
runs:
78
using: "composite"
89
steps:
910
- id: normalize_branch_name
1011
shell: bash
11-
run: echo "normalized_branch_name=$(sed -e 's/[^a-zA-Z0-9-]//g' <<< $(git rev-parse --abbrev-ref HEAD) | tr '[:upper:]' '[:lower:]' | head -c 25)" >> $GITHUB_OUTPUT
12-
12+
run: |
13+
branch=$(git rev-parse --abbrev-ref HEAD)
14+
stripped=$(echo $branch | sed -e 's/[^a-zA-Z0-9-]//g' | tr '[:upper:]' '[:lower:]')
15+
starting_from_jira_ref=$(echo $stripped | sed -n 's/.*\([0-9]\{4,\}.*\)/\1/p')
16+
with_fallback=${starting_from_jira_ref:-$stripped}
17+
chopped=$(echo $with_fallback | head -c 14)
18+
echo "normalized_branch_name=$chopped" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)