Skip to content

Commit a59a612

Browse files
committed
accept release ota branch
1 parent 463be41 commit a59a612

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

.github/scripts/release-branch-sync.sh

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121

2222
set -e
2323

24-
# Regex pattern for valid release branch names (release/X.Y.Z)
25-
RELEASE_BRANCH_PATTERN='^release/[0-9]+\.[0-9]+\.[0-9]+$'
24+
# Regex pattern for valid release branch names (release/X.Y.Z or release/X.Y.Z-ota)
25+
RELEASE_BRANCH_PATTERN='^release/[0-9]+\.[0-9]+\.[0-9]+(-ota)?$'
2626

2727
# -----------------------------------------------------------------------------
2828
# Helper Functions
@@ -71,10 +71,10 @@ pr_exists() {
7171
[[ "$existing_pr" -gt 0 ]]
7272
}
7373

74-
# Parse version from release branch name (release/X.Y.Z -> X.Y.Z)
74+
# Parse version from release branch name (release/X.Y.Z or release/X.Y.Z-ota -> X.Y.Z)
7575
parse_version() {
7676
local branch=$1
77-
echo "$branch" | sed 's|release/||'
77+
echo "$branch" | sed 's|release/||' | sed 's|-ota$||'
7878
}
7979

8080
# Compare two semantic versions
@@ -107,14 +107,15 @@ get_active_release_branches() {
107107
local branches=""
108108

109109
# Query open and draft PRs with title starting with "release:" (case-insensitive)
110-
# The jq filter extracts version from PR titles like "release: 7.36.0" or "Release: 7.36.0 (#1234)"
110+
# The jq filter extracts version from PR titles like "release: 7.36.0", "Release: 7.36.0 (#1234)",
111+
# or OTA variants like "release: 7.81.1-ota"
111112
local pr_data
112113
pr_data=$(gh pr list \
113114
--state open \
114115
--limit 500 \
115116
--search 'in:title release' \
116117
--json title,isDraft \
117-
--jq '.[] | select(.title | test("^release:\\s*[0-9]+\\.[0-9]+\\.[0-9]+"; "i")) | .title' \
118+
--jq '.[] | select(.title | test("^release:\\s*[0-9]+\\.[0-9]+\\.[0-9]+(-ota)?"; "i")) | .title' \
118119
2>/dev/null || echo "")
119120

120121
if [[ -z "$pr_data" ]]; then
@@ -125,11 +126,11 @@ get_active_release_branches() {
125126
# Extract version numbers from PR titles and convert to branch names
126127
while IFS= read -r title; do
127128
if [[ -n "$title" ]]; then
128-
# Extract version (X.Y.Z) from title - jq already validated the format,
129-
# so we just need to extract the first semantic version pattern.
129+
# Extract version (X.Y.Z or X.Y.Z-ota) from title - jq already validated the format,
130+
# so we just need to extract the first semantic version pattern (with optional -ota suffix).
130131
# Using grep -oE is case-agnostic and simpler than matching "release:" variations.
131132
local version
132-
version=$(echo "$title" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
133+
version=$(echo "$title" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+(-ota)?' | head -1)
133134
if [[ -n "$version" ]]; then
134135
local branch="release/${version}"
135136
# Only add if not already in list (use grep -Fx for exact string matching,

0 commit comments

Comments
 (0)