@@ -106,12 +106,15 @@ jobs:
106106          sed -i 's/python:v.*"/python:v'$VERSION'"/' .github/workflows/daily-scan.yml 
107107           
108108          # for patch releases, avoid merge conflict by manually resolving CHANGELOG with main 
109-           if [[ "${{ github.event.inputs.is_patch }}" == "true" ]]; then             
109+           if [[ "${{ github.event.inputs.is_patch }}" == "true" ]]; then 
110+             # Copy the patch release entries 
111+             sed -n "/^## v${VERSION}/,/^## v[0-9]/p" CHANGELOG.md | sed '$d' > /tmp/patch_release_section.txt 
112+ 
110113            git fetch origin main 
111-             git show origin/main:CHANGELOG.md | sed -n '/## Unreleased/,/^## v[0-9]/p' | sed '$d' | tail -n +2 | sed '/^$/d' > /tmp/unreleased_content.txt  
112-                          
113-             # Insert the content right  after the existing "##  Unreleased" header  
114-             sed  -i '/ ## Unreleased/r  /tmp/unreleased_content .txt' CHANGELOG.md 
114+             git show origin/main:CHANGELOG.md > CHANGELOG.md  
115+ 
116+             # Insert the patch release entries  after Unreleased 
117+             awk  -i inplace '/^ ## v[0-9]/ && !inserted { system("cat  /tmp/patch_release_section .txt"); inserted=1 } {print} ' CHANGELOG.md 
115118          fi 
116119           
117120          git add aws-opentelemetry-distro/src/amazon/opentelemetry/distro/version.py 
@@ -133,3 +136,13 @@ jobs:
133136          By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice." \ 
134137                       --head prepare-main-for-next-dev-cycle-${VERSION} \ 
135138                       --base main 
139+ 
140+        - name : Force our CHANGELOG to override merge conflicts 
141+         run : | 
142+           git merge origin/main || true  
143+           git checkout --ours CHANGELOG.md 
144+           git add CHANGELOG.md 
145+           if ! git diff --quiet --cached; then 
146+             git commit -m "Force our CHANGELOG to override merge conflicts" 
147+             git push origin "post-release-${VERSION}" 
148+           fi 
0 commit comments