Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,37 @@ permissions:
contents: read

jobs:
changelog-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check CHANGELOG
run: |
# Check if PR is from pre-release or post-release workflow
if [[ "${{ github.event.pull_request.user.login }}" == "aws-application-signals-bot" ]]; then
echo "Skipping check: PR from aws-application-signals-bot"
exit 0
fi

# Check for Skip Changelog label
if echo '${{ toJSON(github.event.pull_request.labels.*.name) }}' | jq -r '.[]' | grep -q "Skip Changelog"; then
echo "Skipping check: Skip Changelog label found"
exit 0
fi

# Fetch base branch and check for CHANGELOG modifications
git fetch origin ${{ github.base_ref }}
if git diff --name-only origin/${{ github.base_ref }}..HEAD | grep -q "CHANGELOG.md"; then
echo "CHANGELOG.md entry found - check passed"
exit 0
fi

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."
exit 1

build:
runs-on: ubuntu-latest
strategy:
Expand Down
29 changes: 28 additions & 1 deletion .github/workflows/pre-release-prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ jobs:
git commit -am "Update version to ${VERSION}"
git push origin "v${VERSION}_release"

- name: Update CHANGELOG for release
if: github.event.inputs.is_patch != 'true'
run: |
sed -i "s/## Unreleased/## ${VERSION} - $(date +%Y-%m-%d)/" CHANGELOG.md
git add CHANGELOG.md
git commit -m "Update CHANGELOG for version ${VERSION}"
git push origin "v${VERSION}_release"

- name: Create pull request against the release branch
env:
GITHUB_TOKEN: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}
Expand All @@ -103,4 +111,23 @@ jobs:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice." \
--head v${{ github.event.inputs.version }}_release \
--base release/v${MAJOR_MINOR}.x
--base release/v${MAJOR_MINOR}.x

- name: Create pull request against main for CHANGELOG
if: github.event.inputs.is_patch != 'true'
env:
GITHUB_TOKEN: ${{ env.BOT_TOKEN_GITHUB_RW_PATOKEN }}
run: |
git checkout -b "v${VERSION}_changelog_main"

sed -i "s/## Unreleased/## Unreleased\n\n## ${VERSION} - $(date +%Y-%m-%d)/" CHANGELOG.md
git add CHANGELOG.md
git commit -m "Add ${VERSION} to CHANGELOG"
git push origin "v${VERSION}_changelog_main"

gh pr create --title "Add ${VERSION} to CHANGELOG" \
--body "This PR adds the ${VERSION} release entry to CHANGELOG.md.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice." \
--head v${{ github.event.inputs.version }}_changelog_main \
--base main
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

All notable changes to this project will be documented in this file.

> **Note:** This CHANGELOG was created starting from version 0.12.0. Earlier changes are not documented here.
## Unreleased
Loading