Skip to content

Commit 015085c

Browse files
ezhang6811thpierce
andauthored
add CHANGELOG.md (#465)
*Issue #, if available:* *Description of changes:* Add CHANGELOG.md to track future features and fixes made to ADOT. Updated pr-build.yml workflow to check that CHANGELOG.md has been updated for all changes that affect SDK behavior. Updated pre-release-prepare.yml workflow to update CHANGELOG in both release series branch and main branch, moving the Unreleased changes under a header for the new release version. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. --------- Co-authored-by: Thomas Pierce <[email protected]>
1 parent 8fd3f21 commit 015085c

File tree

4 files changed

+84
-0
lines changed

4 files changed

+84
-0
lines changed

.github/workflows/post-release-version-bump.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
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

1014
env:
1115
AWS_DEFAULT_REGION: us-east-1
@@ -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 "post-release-${VERSION}"
148+
fi

.github/workflows/pr-build.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,42 @@ permissions:
1010
contents: read
1111

1212
jobs:
13+
changelog-check:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Check CHANGELOG
21+
run: |
22+
# Check if PR is from workflows bot or dependabot
23+
if [[ "${{ github.event.pull_request.user.login }}" == "aws-application-signals-bot" ]]; then
24+
echo "Skipping check: PR from aws-application-signals-bot"
25+
exit 0
26+
fi
27+
28+
if [[ "${{ github.event.pull_request.user.login }}" == "dependabot[bot]" ]]; then
29+
echo "Skipping check: PR from dependabot"
30+
exit 0
31+
fi
32+
33+
# Check for skip changelog label
34+
if echo '${{ toJSON(github.event.pull_request.labels.*.name) }}' | jq -r '.[]' | grep -q "skip changelog"; then
35+
echo "Skipping check: skip changelog label found"
36+
exit 0
37+
fi
38+
39+
# Fetch base branch and check for CHANGELOG modifications
40+
git fetch origin ${{ github.base_ref }}
41+
if git diff --name-only origin/${{ github.base_ref }}..HEAD | grep -q "CHANGELOG.md"; then
42+
echo "CHANGELOG.md entry found - check passed"
43+
exit 0
44+
fi
45+
46+
echo "It looks like you didn't add an entry to CHANGELOG.md. If this change affects the SDK behavior, please update CHANGELOG.md and link this PR in your entry. If this PR does not need a CHANGELOG entry, you can add the 'Skip Changelog' label to this PR."
47+
exit 1
48+
1349
build:
1450
runs-on: ubuntu-latest
1551
strategy:

.github/workflows/pre-release-prepare.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ jobs:
9494
git commit -am "Update version to ${VERSION}"
9595
git push origin "v${VERSION}_release"
9696
97+
- name: Update CHANGELOG for release
98+
run: |
99+
sed -i "s/## Unreleased/## Unreleased\n\n## v${VERSION} - $(date +%Y-%m-%d)/" CHANGELOG.md
100+
git add CHANGELOG.md
101+
git commit -m "Update CHANGELOG for version ${VERSION}"
102+
git push origin "v${VERSION}_release"
103+
97104
- name: Create pull request against the release branch
98105
env:
99106
GITHUB_TOKEN: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
> **Note:** This CHANGELOG was created starting from version 0.12.0. Earlier changes are not documented here.
6+
7+
For any change that affects end users of this package, please add an entry under the **Unreleased** section. Briefly summarize the change and provide the link to the PR. Example:
8+
- add GenAI attribute support for Amazon Bedrock models
9+
([#300](https://github.com/aws-observability/aws-otel-python-instrumentation/pull/300))
10+
11+
If your change does not need a CHANGELOG entry, add the "skip changelog" label to your PR.
12+
13+
## Unreleased

0 commit comments

Comments
 (0)