Skip to content

Commit 2820397

Browse files
Merge pull request #151 from Mellanox/almaslennikov-patch-4
fix: sorting logic when looking up most recent release branch
2 parents 992cd91 + caab363 commit 2820397

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

.github/workflows/fork-sync-reusable.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,15 @@ jobs:
3333
id: lookup-most-recent-release-branch
3434
run: |
3535
git fetch --all --tags
36-
most_recent_release_branch=$(git branch --remotes --sort refname | grep network-operator- | tail -n 1 | cut -d '/' -f 2-) # example: network-operator-25.10.x
36+
most_recent_release_branch=$(
37+
git branch -r \
38+
| grep 'network-operator-[0-9]*\.[0-9]*\.x' \
39+
| sed 's#.*/##' \
40+
| sed 's/network-operator-//' \
41+
| sort -V \
42+
| tail -n 1 \
43+
| xargs -I{} echo "network-operator-{}"
44+
)
3745
echo most_recent_release_branch=$most_recent_release_branch | tee -a $GITHUB_OUTPUT
3846
3947
most_recent_release_branch_major_minor=$(echo $most_recent_release_branch | cut -d '-' -f 3 | sed 's/.x//') # example: 25.10

0 commit comments

Comments
 (0)