Skip to content

Commit 9c7b228

Browse files
ezhang6811jj22ee
authored andcommitted
add CHANGELOG.md (#1187)
*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, moving the Unreleased changes under a header for the new release version. Updated post-release-version-bump.yml to merge CHANGELOG back into main, resolving any conflicts. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 22a48a9 commit 9c7b228

File tree

4 files changed

+91
-1
lines changed

4 files changed

+91
-1
lines changed

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

Lines changed: 27 additions & 1 deletion
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,20 @@ jobs:
100104
sed -i'' -e "s/val adotVersion = \".*\"/val adotVersion = \"${DEV_VERSION}\"/" version.gradle.kts
101105
VERSION="${{ github.event.inputs.version }}"
102106
sed -i'' -e 's/adot-autoinstrumentation-java:v2.*"/adot-autoinstrumentation-java: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+
git fetch origin main
113+
git show origin/main:CHANGELOG.md > CHANGELOG.md
114+
# Insert the patch release entries after Unreleased
115+
awk -i inplace '/^## v[0-9]/ && !inserted { system("cat /tmp/patch_release_section.txt"); inserted=1 } {print}' CHANGELOG.md
116+
fi
117+
103118
git add version.gradle.kts
104119
git add .github/workflows/daily-scan.yml
120+
git add CHANGELOG.md
105121
git commit -m "Prepare main for next development cycle: Update version to $DEV_VERSION"
106122
git push --set-upstream origin "prepare-main-for-next-dev-cycle-${VERSION}"
107123
@@ -117,4 +133,14 @@ jobs:
117133
118134
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice." \
119135
--head prepare-main-for-next-dev-cycle-${VERSION} \
120-
--base main
136+
--base main
137+
138+
- name: Force our CHANGELOG to override merge conflicts
139+
run: |
140+
git merge origin/main || true
141+
git checkout --ours CHANGELOG.md
142+
git add CHANGELOG.md
143+
if ! git diff --quiet --cached; then
144+
git commit -m "Force our CHANGELOG to override merge conflicts"
145+
git push origin "prepare-main-for-next-dev-cycle-${VERSION}"
146+
fi

.github/workflows/pr-build.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,55 @@
11
name: PR Build
22
on:
33
pull_request:
4+
types:
5+
- opened
6+
- reopened
7+
- synchronize
8+
- labeled
9+
- unlabeled
410
branches:
511
- main
612
- "release/v*"
713
env:
814
TEST_TAG: public.ecr.aws/aws-observability/adot-autoinstrumentation-java:test-v2
915

1016
jobs:
17+
changelog-check:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Check CHANGELOG
25+
run: |
26+
# Check if PR is from workflows bot or dependabot
27+
if [[ "${{ github.event.pull_request.user.login }}" == "aws-application-signals-bot" ]]; then
28+
echo "Skipping check: PR from aws-application-signals-bot"
29+
exit 0
30+
fi
31+
32+
if [[ "${{ github.event.pull_request.user.login }}" == "dependabot[bot]" ]]; then
33+
echo "Skipping check: PR from dependabot"
34+
exit 0
35+
fi
36+
37+
# Check for skip changelog label
38+
if echo '${{ toJSON(github.event.pull_request.labels.*.name) }}' | jq -r '.[]' | grep -q "skip changelog"; then
39+
echo "Skipping check: skip changelog label found"
40+
exit 0
41+
fi
42+
43+
# Fetch base branch and check for CHANGELOG modifications
44+
git fetch origin ${{ github.base_ref }}
45+
if git diff --name-only origin/${{ github.base_ref }}..HEAD | grep -q "CHANGELOG.md"; then
46+
echo "CHANGELOG.md entry found - check passed"
47+
exit 0
48+
fi
49+
50+
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."
51+
exit 1
52+
1153
testpatch:
1254
name: Test patches applied to dependencies
1355
runs-on: aws-otel-java-instrumentation_ubuntu-latest_32-core

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ jobs:
9494
git commit -am "Update version to ${VERSION}"
9595
git push origin "v${VERSION}_release"
9696
97+
- name: Update CHANGELOG for release
98+
if: github.event.inputs.is_patch != 'true'
99+
run: |
100+
sed -i "s/## Unreleased/## Unreleased\n\n## v${VERSION} - $(date +%Y-%m-%d)/" CHANGELOG.md
101+
git add CHANGELOG.md
102+
git commit -m "Update CHANGELOG for version ${VERSION}"
103+
git push origin "v${VERSION}_release"
104+
97105
- name: Create pull request against the release branch
98106
env:
99107
GITHUB_TOKEN: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
> **Note:** This CHANGELOG was created starting after version 2.11.5. 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+
9+
- add SigV4 authentication for HTTP exporter
10+
([#1019](https://github.com/aws-observability/aws-otel-java-instrumentation/pull/1019))
11+
12+
If your change does not need a CHANGELOG entry, add the "skip changelog" label to your PR.
13+
14+
## Unreleased

0 commit comments

Comments
 (0)