@@ -129,80 +129,3 @@ jobs:
129129 --notes-file /tmp/release-notes.txt \
130130 --discussion-category announcements \
131131 v$STABLE_VERSION
132-
133- - uses : actions/checkout@v4
134- with :
135- # the step below is creating a pull request against main
136- ref : main
137-
138- - name : Copy change log updates to main
139- env :
140- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
141- run : |
142- if [[ -z $PRIOR_VERSION_WHEN_PATCH ]]; then
143- # this was not a patch release, so the version exists already in the CHANGELOG.md
144-
145- # update the release date
146- date=$(gh release view v$STABLE_VERSION --json publishedAt --jq .publishedAt | sed 's/T.*//')
147- sed -Ei "s/## Version ${STABLE_VERSION}\/${UNSTABLE_VERSION} .*/## Version ${STABLE_VERSION}\/${UNSTABLE_VERSION} ($date)/" CHANGELOG.md
148-
149- # the entries are copied over from the release branch to support workflows
150- # where change log entries may be updated after preparing the release branch
151-
152- # copy the portion above the release, up to and including the heading
153- sed -n "0,/^## Version ${STABLE_VERSION}\/${UNSTABLE_VERSION} ($date)/p" CHANGELOG.md > /tmp/CHANGELOG.md
154-
155- # copy the release notes
156- cat /tmp/CHANGELOG_SECTION.md >> /tmp/CHANGELOG.md
157-
158- # copy the portion below the release
159- sed -n "0,/^## Version ${STABLE_VERSION}\/${UNSTABLE_VERSION} /d;0,/^## Version /{/^## Version/!d};p" CHANGELOG.md \
160- >> /tmp/CHANGELOG.md
161-
162- # update the real CHANGELOG.md
163- cp /tmp/CHANGELOG.md CHANGELOG.md
164- else
165- # this was a patch release, so the version does not exist already in the CHANGELOG.md
166-
167- # copy the portion above the top-most release, not including the heading
168- sed -n "0,/^## Version /{ /^## Version /!p }" CHANGELOG.md > /tmp/CHANGELOG.md
169-
170- # add the heading
171- date=$(gh release view v$STABLE_VERSION --json publishedAt --jq .publishedAt | sed 's/T.*//')
172- echo "## Version ${STABLE_VERSION}/${UNSTABLE_VERSION} ($date)" >> /tmp/CHANGELOG.md
173-
174- # copy the release notes
175- cat /tmp/CHANGELOG_SECTION.md >> /tmp/CHANGELOG.md
176-
177- # copy the portion starting from the top-most release
178- sed -n "/^## Version /,\$p" CHANGELOG.md >> /tmp/CHANGELOG.md
179-
180- # update the real CHANGELOG.md
181- cp /tmp/CHANGELOG.md CHANGELOG.md
182- fi
183-
184- - name : Use CLA approved github bot
185- run : .github/scripts/use-cla-approved-github-bot.sh
186-
187- - name : Create pull request against main
188- env :
189- # not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
190- GITHUB_TOKEN : ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
191- run : |
192- message="Copy change log updates from $GITHUB_REF_NAME"
193- body="Copy log updates from \`$GITHUB_REF_NAME\`."
194- branch="opentelemetrybot/copy-change-log-updates-from-${GITHUB_REF_NAME//\//-}"
195-
196- if [[ -z $PRIOR_VERSION_WHEN_PATCH ]]; then
197- if git diff --quiet; then
198- echo there are no updates needed to the change log on main, not creating pull request
199- exit 0 # success
200- fi
201- fi
202-
203- git commit -a -m "$message"
204- git push origin HEAD:$branch
205- gh pr create --title "$message" \
206- --body "$body" \
207- --head $branch \
208- --base main
0 commit comments