@@ -114,11 +114,11 @@ jobs:
114114 # e.g. if this release is `release/5.0.x`, value in `gather-docs.yaml`
115115 # should be `release/4.<whatever_last_minor_release_version_was>.x`
116116 # additionally if major version bump, the `mergify.yml` also needs to be edited manually
117- # if this release is `release/5.0.x`, the branch variables in `mergify.yml` should be updated to look like:
118- # current_minor: ¤t_minor "release/5.0.x"
119- # previous_minor: &previous_minor null
120- # previous_major: &previous_major "release/4.<whatever_last_minor_release_version_was>.x"
121- # NOTE - previous_minor is intentionally set to null since there is no previous minor branch in a major release
117+ # if this release is `release/5.0.x`, the branch entries in `mergify.yml` should be updated to look like:
118+ # - ¤t_minor "release/5.0.x"
119+ # - &previous_minor "release/4.<whatever_last_minor_release_version_was>.x"
120+ # - &previous_major "release/4.<whatever_last_minor_release_version_was>.x"
121+ # NOTE - previous_minor should be set to the same value as previous_major in a major release since there is no previous minor branch
122122
123123 if [ $((previousMinorVersion)) -lt 0 ]
124124 then
@@ -152,21 +152,21 @@ jobs:
152152 echo "Updating mergify.yml backport branches for $newCurrentMinor"
153153
154154 # Get the current value of current_minor to move it to previous_minor
155- # Find the line containing current_minor in mergify.yml
156- currentMinorLine=$(grep "current_minor: " "$mergifyPath" | head -n 1)
155+ # Find the line containing & current_minor in mergify.yml
156+ currentMinorLine=$(grep "& current_minor " "$mergifyPath" | head -n 1)
157157 # Extract quoted string value from the line
158- currentMinorValue=$(echo "$currentMinorLine" | sed -n 's/.*current_minor: ¤t_minor "\([^"]*\)".*/\1/p')
158+ currentMinorValue=$(echo "$currentMinorLine" | sed -n 's/.*¤t_minor "\([^"]*\)".*/\1/p')
159159
160- # If there was no quoted string found, or if it is null, exit with error
161- if [ -z "$currentMinorValue" ] || [ "$currentMinorValue" = "null" ] ; then
160+ # If there was no quoted string found, exit with error
161+ if [ -z "$currentMinorValue" ]; then
162162 echo "Error: Unable to determine non-null current_minor value from $mergifyPath (line: $currentMinorLine)"
163163 exit 1
164164 fi
165165 echo "Moving current minor '$currentMinorValue' to previous minor and setting new current minor to '$newCurrentMinor'"
166166
167- # Handle both quoted strings and null values for previous_minor (matches both "value" and null)
168- sed -ri "s|previous_minor: &previous_minor (\".*\"\|null)|previous_minor: \&previous_minor \"$currentMinorValue\"|" "$mergifyPath"
169- sed -i "s|current_minor: ¤t_minor \". *\"|current_minor: \¤t_minor \"$newCurrentMinor\"|" "$mergifyPath"
167+ # Update the inline YAML anchor entries in the branches list
168+ sed -i "s|- &previous_minor \"[^\"]*\"|- \&previous_minor \"$currentMinorValue\"|" "$mergifyPath"
169+ sed -i "s|- ¤t_minor \"[^\"] *\"|- \¤t_minor \"$newCurrentMinor\"|" "$mergifyPath"
170170
171171 # Commit and push changes
172172 git add "$mergifyPath"
0 commit comments