Skip to content

Commit 43cdc8b

Browse files
mergify[bot]anmolshres98ben-polinsky
authored
ci(mergify): upgrade configuration to current format (#9051)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: anmolshres98 <anmolshres98@users.noreply.github.com> Co-authored-by: Ben Polinsky <78756012+ben-polinsky@users.noreply.github.com>
1 parent 1f415fa commit 43cdc8b

2 files changed

Lines changed: 17 additions & 22 deletions

File tree

.github/mergify.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
# Configuration file for mergify
22

3-
# Branch version variables
4-
variables:
5-
current_minor: &current_minor "release/5.7.x"
6-
previous_minor: &previous_minor "release/5.6.x"
7-
previous_major: &previous_major "release/4.11.x"
8-
93
defaults:
104
actions:
115
backport:
@@ -44,6 +38,7 @@ pull_request_rules:
4438
actions:
4539
backport:
4640
branches:
47-
- *current_minor
48-
- *previous_minor
49-
- *previous_major
41+
- &current_minor "release/5.7.x"
42+
- &previous_minor "release/5.6.x"
43+
- &previous_major "release/4.11.x"
44+

common/config/azure-pipelines/jobs/version-bump.yaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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: &current_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+
# - &current_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: &current_minor "\([^"]*\)".*/\1/p')
158+
currentMinorValue=$(echo "$currentMinorLine" | sed -n 's/.*&current_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: &current_minor \".*\"|current_minor: \&current_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|- &current_minor \"[^\"]*\"|- \&current_minor \"$newCurrentMinor\"|" "$mergifyPath"
170170
171171
# Commit and push changes
172172
git add "$mergifyPath"

0 commit comments

Comments
 (0)