File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
.github/actions/normalize-branch-name Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -2,11 +2,17 @@ name: "Normalize branch name"
22description : " Normalize branch name"
33outputs :
44 normalized_branch_name :
5+ description : 14 character branch identifier (0000-thebranch)
56 value : ${{ steps.normalize_branch_name.outputs.normalized_branch_name }}
67runs :
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
You can’t perform that action at this time.
0 commit comments