1212 test :
1313 runs-on : ubuntu-latest
1414 steps :
15- - name : Checkout sources
15+ - name : Checkout repository
1616 uses : actions/checkout@v4
17- - name : Run GH action
18- uses : ./.github/actions/sync-feature-branches
19- with :
20- disabled-feature-branches : ' test-main'
17+
18+ - name : Set up Git
19+ shell : bash
20+ run : |
21+ git config user.name aws-sdk-kotlin-ci
22+ git config user.email "[email protected] " 23+
24+ - name : Merge main into feature branches
25+ shell : bash
26+ run : |
27+ echo "Parsing disabled feature branches"
28+ unparsed_disabled_feature_branches="${{ inputs.disabled-feature-branches }}"
29+ IFS=',' read -r -a disabled_feature_branches <<< "$unparsed_disabled_feature_branches"
30+ for i in "${!disabled_feature_branches[@]}"; do
31+ disabled_feature_branches[i]=$(echo "${disabled_feature_branches[i]}" | xargs)
32+ echo "Found: $disabled_feature_branches[i]"
33+ done
34+
35+ git fetch --all
36+
37+ echo "Iterating through feature branches"
38+ for feature_branch in $(git branch -r --list "*-main"); do # TODO: ALL OF THESE WILL HAVE "origin/" in front of them
39+ echo "Found: $feature_branch"
40+
41+ for disabled_feature_branch in "${disabled_feature_branches[@]}"; do
42+ if [[ "$feature_branch" == "$disabled_feature_branch" ]]; then
43+ echo "Main will not be merged into $feature_branch because it was manually disabled"
44+ continue
45+ fi
46+ done
47+
48+ echo "Checking if $feature_branch is up to date with main"
49+ git checkout $feature_branch
50+ git fetch origin
51+ commits_behind=$(git rev-list --left-right --count main...$feature_branch | awk '{print $1})
52+ if [ "$commits_behind" -eq 0 ]; then
53+ echo "$feature_branch is 0 commits behind main. Skipping merge"
54+ continue
55+ fi
0 commit comments