66      version :
77        description : ' Version number (e.g., 1.0.1)' 
88        required : true 
9+       is_patch :
10+         description : ' Is this a patch? (true or false)' 
11+         required : true 
12+         default : ' false' 
913
1014env :
1115  AWS_DEFAULT_REGION : us-east-1 
2024    runs-on : ubuntu-latest 
2125    steps :
2226      - name : Checkout main 
23-         uses : actions/checkout@v2  
27+         uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8   # v5.0.0 
2428        with :
2529          ref : main 
2630          fetch-depth : 0 
@@ -59,21 +63,21 @@ jobs:
5963    needs : check-version 
6064    steps :
6165      - name : Configure AWS credentials for BOT secrets 
62-         uses : aws-actions/configure-aws-credentials@v4  
66+         uses : aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838   # v5.0.0 
6367        with :
6468          role-to-assume : ${{ secrets.AWS_ROLE_ARN_SECRETS_MANAGER }} 
6569          aws-region : ${{ env.AWS_DEFAULT_REGION }} 
6670
6771      - name : Get Bot secrets 
68-         uses : aws-actions/aws-secretsmanager-get-secrets@v1  
72+         uses : aws-actions/aws-secretsmanager-get-secrets@a9a7eb4e2f2871d30dc5b892576fde60a2ecc802   # v2.0.10 
6973        id : bot_secrets 
7074        with :
7175          secret-ids : | 
7276            BOT_TOKEN ,${{ secrets.BOT_TOKEN_SECRET_ARN }} 
7377parse-json-secrets : true 
7478
7579      - name : Setup Git 
76-         uses : actions/checkout@v2  
80+         uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8   # v5.0.0 
7781        with :
7882          fetch-depth : 0 
7983          token : ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }} 
@@ -100,8 +104,22 @@ jobs:
100104          sed -i 's/__version__ = ".*"/__version__ = "'$DEV_VERSION'"/' aws-opentelemetry-distro/src/amazon/opentelemetry/distro/version.py 
101105          VERSION="${{ github.event.inputs.version }}" 
102106          sed -i 's/python:v.*"/python:v'$VERSION'"/' .github/workflows/daily-scan.yml 
107+            
108+           # for patch releases, avoid merge conflict by manually resolving CHANGELOG with main 
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+ 
113+             git fetch origin main 
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 
118+           fi 
119+            
103120          git add aws-opentelemetry-distro/src/amazon/opentelemetry/distro/version.py 
104121          git add .github/workflows/daily-scan.yml 
122+           git add CHANGELOG.md 
105123          git commit -m "Prepare main for next development cycle: Update version to $DEV_VERSION" 
106124          git push --set-upstream origin "prepare-main-for-next-dev-cycle-${VERSION}" 
107125
@@ -118,3 +136,13 @@ jobs:
118136          By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice." \ 
119137                       --head prepare-main-for-next-dev-cycle-${VERSION} \ 
120138                       --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 "prepare-main-for-next-dev-cycle-${VERSION}" 
148+           fi 
0 commit comments