Skip to content

Commit 2cf2d15

Browse files
authored
add CHANGELOG.md (#262)
*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 you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent d463605 commit 2cf2d15

File tree

4 files changed

+89
-1
lines changed

4 files changed

+89
-1
lines changed

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

Lines changed: 26 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
@@ -109,6 +113,17 @@ jobs:
109113
VERSION="${{ github.event.inputs.version }}"
110114
npm install
111115
sed -i "s|\(/aws-observability/adot-autoinstrumentation-node:\)v[0-9]\+\.[0-9]\+\.[0-9]\+|\1v${{github.event.inputs.version}}|g" .github/workflows/daily-scan.yml
116+
117+
# for patch releases, avoid merge conflict by manually resolving CHANGELOG with main
118+
if [[ "${{ github.event.inputs.is_patch }}" == "true" ]]; then
119+
# Copy the patch release entries
120+
sed -n "/^## v${VERSION}/,/^## v[0-9]/p" CHANGELOG.md | sed '$d' > /tmp/patch_release_section.txt
121+
git fetch origin main
122+
git show origin/main:CHANGELOG.md > CHANGELOG.md
123+
# Insert the patch release entries after Unreleased
124+
awk -i inplace '/^## v[0-9]/ && !inserted { system("cat /tmp/patch_release_section.txt"); inserted=1 } {print}' CHANGELOG.md
125+
fi
126+
112127
git add .
113128
git status
114129
git commit -m "Prepare main for next development cycle: Update version to $DEV_VERSION"
@@ -126,4 +141,14 @@ jobs:
126141
127142
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice." \
128143
--head prepare-main-for-next-dev-cycle-${VERSION} \
129-
--base main
144+
--base main
145+
146+
- name: Force our CHANGELOG to override merge conflicts
147+
run: |
148+
git merge origin/main || true
149+
git checkout --ours CHANGELOG.md
150+
git add CHANGELOG.md
151+
if ! git diff --quiet --cached; then
152+
git commit -m "Force our CHANGELOG to override merge conflicts"
153+
git push origin "prepare-main-for-next-dev-cycle-${VERSION}"
154+
fi

.github/workflows/pr-build.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: JavaScript Instrumentation 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*"
@@ -10,6 +16,42 @@ permissions:
1016
contents: read
1117

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

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ jobs:
102102
npm install
103103
git commit -am "Update version to ${VERSION}"
104104
git push origin "v${VERSION}_release"
105+
106+
- name: Update CHANGELOG for release
107+
run: |
108+
sed -i "s/## Unreleased/## Unreleased\n\n## v${VERSION} - $(date +%Y-%m-%d)/" CHANGELOG.md
109+
git add CHANGELOG.md
110+
git commit -m "Update CHANGELOG for version ${VERSION}"
111+
git push origin "v${VERSION}_release"
105112
106113
- name: Create pull request against the release branch
107114
env:

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 0.7.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+
9+
- add GenAI attribute support for Amazon Bedrock models
10+
([#111](https://github.com/aws-observability/aws-otel-js-instrumentation/pull/111))
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)