Skip to content

Commit

Permalink
Update cron-build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
isboston committed Dec 14, 2024
1 parent 40ce6c2 commit beed902
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions .github/workflows/cron-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,21 @@ jobs:
id: list-branches
run: |
all_branches=$(git ls-remote -hq | sed -n 's/^[0-9a-f]\{40\}\s\+refs\/heads\//''/p')
matching_branches=$(
{
echo "$all_branches" | grep '^release/v[0-9]'
echo "$all_branches" | grep '^hotfix/v[0-9]'
echo "$all_branches" | grep '^develop$'
} | sed 's/^/"/; s/$/"/'
matching_branches=$(echo "$all_branches" | awk '
/^release\/v[0-9]/ || /^hotfix\/v[0-9]/ || /^develop$/ {
branches[++i] = "\"" $0 "\""
}
END {
printf("[")
for (j = 1; j <= i; j++) {
printf("%s%s", branches[j], (j < i ? ", " : ""))
}
printf("]")
}'
)
echo "json_output=[${matching_branches//$'\n'/,}]" >> $GITHUB_OUTPUT
echo "branches=${matching_branches//$'\n'/ }" | tr -d '[]\"' >> $GITHUB_OUTPUT
echo "json_branches=$matching_branches" >> $GITHUB_ENV
- name: Determine Priority Branch
id: priority
Expand Down Expand Up @@ -61,7 +67,7 @@ jobs:
--data '{
"ref": "'"${{ github.ref_name }}"'",
"inputs": {
"branches": "[\"release/v3.0.0\", \"hotfix/v3.0.1\", \"develop\"]"
"branches": "'"${{ env.json_branches }}"'"
}
}'
Expand Down

0 comments on commit beed902

Please sign in to comment.