diff --git a/.github/scripts/update-release-changelog.sh b/.github/scripts/update-release-changelog.sh index b9f717fe..ea976136 100755 --- a/.github/scripts/update-release-changelog.sh +++ b/.github/scripts/update-release-changelog.sh @@ -166,10 +166,27 @@ commit_and_push_changelog() { if [[ "${previous_version_ref,,}" == "null" ]]; then commit_msg="${commit_msg} (hotfix - no test plan)" fi - if ! git commit -am "${commit_msg}"; then + + local changes_committed=false + if git commit -am "${commit_msg}"; then + changes_committed=true + else echo "No changes detected; skipping commit." fi + # Check if there are any differences between the changelog branch and release branch + if ! ${changes_committed}; then + echo "Checking for differences between ${changelog_branch} and ${release_branch}.." + if ! git diff --quiet "origin/${release_branch}" "HEAD"; then + echo "Differences found between branches; proceeding with PR creation." + else + echo "No differences between ${changelog_branch} and ${release_branch}." + echo "Branches are already in sync; skipping PR creation." + echo "Changelog workflow completed successfully (no updates needed)." + return 0 + fi + fi + local pr_body="This PR updates the change log for ${version}." if [[ "${previous_version_ref,,}" == "null" ]]; then pr_body="${pr_body} (Hotfix - no test plan generated.)" diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d561c1e..d4108466 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,12 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - - Adds ability to merge Version Bump PRs with PR comment ([#179](https://github.com/MetaMask/github-tools/pull/179)) +- Adds ability to merge Version Bump PRs with PR comment ([#179](https://github.com/MetaMask/github-tools/pull/179)) -### Changed - - - Update to use topology.json instead of old teams.json for commits.csv during create release pr ([#180](https://github.com/MetaMask/github-tools/pull/180)) +### Changed +- Update to use topology.json instead of old teams.json for commits.csv during create release pr ([#180](https://github.com/MetaMask/github-tools/pull/180)) ## [1.1.0] @@ -46,6 +45,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Some inputs were renamed for consistency across actions. - Bump `actions/checkout` and `actions/setup-node` to `v6` ([#173](https://github.com/MetaMask/github-tools/pull/173)) -[Unreleased]: https://github.com/MetaMask/github-tools/compare/v1.1.0...HEAD +[Unreleased]: https://github.com/MetaMask/github-tools/compare/v1.1.2...HEAD +[1.1.2]: https://github.com/MetaMask/github-tools/compare/v1.1.0...v1.1.2 [1.1.0]: https://github.com/MetaMask/github-tools/compare/v1.0.0...v1.1.0 [1.0.0]: https://github.com/MetaMask/github-tools/releases/tag/v1.0.0